<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RBDevZone &#187; Visual Basic</title>
	<atom:link href="http://www.rbdevzone.com/category/visual-basic/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rbdevzone.com</link>
	<description>The REALbasic Resource</description>
	<lastBuildDate>Tue, 31 Aug 2010 19:55:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>REAL Studio: About the Name Change</title>
		<link>http://www.rbdevzone.com/2010/02/real-studio-about-the-name-change/</link>
		<comments>http://www.rbdevzone.com/2010/02/real-studio-about-the-name-change/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 16:07:02 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Visual Basic]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/?p=372</guid>
		<description><![CDATA[Starting with 2010 Release 1, REALbasic is now known as REAL Studio.  Here are the new edition names:



Old Name
New Name


REALbasic Personal
REAL Studio Personal


REALbasic Professional
REAL Studio Professional


REAL Studio
REAL Studio Enterprise



There is a recent thread on the REAL Software forums asking why REALbasic isn&#8217;t more popular. I&#8217;d say one of the main reasons that REALbasic is [...]]]></description>
			<content:encoded><![CDATA[<p>Starting with 2010 Release 1, REALbasic is now known as REAL Studio.  Here are the new edition names:</p>
<table border="1">
<tbody>
<tr>
<th>Old Name</th>
<th>New Name</th>
</tr>
<tr>
<td>REALbasic Personal</td>
<td>REAL Studio Personal</td>
</tr>
<tr>
<td>REALbasic Professional</td>
<td>REAL Studio Professional</td>
</tr>
<tr>
<td>REAL Studio</td>
<td>REAL Studio Enterprise</td>
</tr>
</tbody>
</table>
<p>There is a recent thread on the REAL Software <a href="http://forums.realsoftware.com/viewtopic.php?f=9&amp;t=27822">forums</a> asking why REALbasic isn&#8217;t more popular. I&#8217;d say one of the main reasons that REALbasic is not as popular as it could be is because of its name.  I have high hopes for the new REAL Studio name.  Unfortunately, when it comes to programming languages, the term Basic gets a bad rap.  Even in the .NET world, where there is practically no difference between C# and VB.NET, there are lots of developers that turn their nose down on VB.NET and assume it is inferior.</p>
<h2>The problem with Basic</h2>
<p>Personally, I don&#8217;t think it&#8217;s possible to fix the perception problem with Basic.  When you mention Basic, people still think:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">10 <span style="color: #000080;">PRINT</span> <span style="color: #800000;">&quot;PAUL&quot;</span>
20 <span style="color: #000080;">GOTO</span> 10
RUN</pre></div></div>

<p>Basic&#8217;s accessibility has always been considered a weakness by many who call themselves professionals.  Because it is so accessible, just about anyone can learn enough to use it to make software.  And if that software doesn&#8217;t end up being very good, people tend to blame the tool instead of the inexperienced programmer.  But the accessibility of Basic is also its greatest strength.  There are plenty of people who aren&#8217;t professional programmers but are experts in their business domain.  These people can use a tool like REAL Studio to create simple application to make their lives easier.  And if they need more sophisticated software, they can turn to us consultants that like to use fun, powerful tools such as REAL Studio.</p>
<p>I also feel that REALbasic&#8217;s popularity was also hampered by its name being a bad pun: it&#8217;s &#8220;real basic&#8221;.  Lots of developers take that to mean &#8220;incredible simplistic and inappropriate for professional software development.  They have no idea what the REALbasic language is capable of and have no interest in finding out.  So they never learn that it is a fully object-oriented language that has far more in common with Java (or .NET) than any old-school version of Basic that they may remember.  I truly hope that the new name helps improve this perception.</p>
<p>But even if the product is now referred to as REAL Studio, the programming language is still referred to as REALbasic.  And it will take quite a bit of time before the new name is used consistently.</p>
<p>Two other products that I think compare well to REAL Studio are PowerBuilder and Delphi.  Like the new REAL Studio branding, note that they each use separate names for the product and the programming language they use (Delphi/Objective-Pascal, PowerBuilder/PowerScript).  You might also make the same case when it comes to Xcode and Objective-C.  And most developers that use those tools refer to themselves as Delphi or PowerBuilder developers.  So perhaps, given time, people will also stop referring to REAL Studio as REALbasic.</p>
<p>But even if that is the case, is REALbasic still a good name?  I think that the REALbasic language has outgrown its &#8220;real basic&#8221; name.  I first learned to program on an Atari 400 back in the early 80&#8217;s using Atari BASIC.  I then migrated from that to structured Basics (such as GFA Basic), Pascal, C and on to a variety of programming languages.  I was one of those that thought Visual Basic was a terrible language and thumbed my nose at it, although I may have been right about Visual Basic (before .NET anyway).  These languages were all &#8220;real basic&#8221;.</p>
<p>But unlike any of the above languages, both REAL Studio and VB.NET (which Microsoft has taken to calling just Visual Basic these days) use a powerful, modern object-oriented version of Basic with a ton of sophisticated features (namespaces, instrospection, dynamic programming, delegates to name a few).  For all practical purposes there is little difference between using them or using Java, C# or any other object-oriented language.</p>
<p>So even if the REALbasic language was once &#8220;real basic&#8221; it no longer is.  I think the name ought to be changed, especially now that REAL Studio has become the product name.  I suggest either choosing something meaningless and invented (like Ruby or Python; I suggest Bee) or something that truly describes what it is (like Objective-Basic<sup>1</sup> or Object Basic<sup>2</sup>; I suggest OObasic).</p>
<p>This does beg the question as to what those of us that use REALbasic or RB in our web site or product names ought to do?  Does it make sense for me to rename RBDevZone to be RSDevZone?  What about the Association of REALbasic Professionals (<a href="http://www.arbp.org">ARBP</a>)?  And <a href="http://www.rbdeveloper.com">REALbasic Developer Magazine</a>? RBGarage?</p>
<h2>How do you compete with Free?</h2>
<p>Another complaint about REAL Studio that I hear often is that it is too expensive.  Generally this is just not true because REAL Studio Professional and REAL Studio Enterprise both cost less than equivalent editions of Visual Studio, PowerBulder or Delphi.  In the case of Delphi and Visual Studio there are free editions: Turbo Delphi and Visual Basic Express.  And of course, Xcode is completely free for OS X developers.  Microsoft also tends to make its developer tools <a href="http://www.microsoft.com/BizSpark/">very affordable</a> (almost free) for startup companies.</p>
<p>I think it would be great for REAL could also offer a free edition of REAL Studio.  Since I&#8217;m on a roll, my  recommendation to REAL is that they offer REAL Studio Free Edition with the same features as REAL Studio Personal Edition except for one thing: it would be unable to compile independent executables.</p>
<p>I see lots of benefits to both REAL and the community with a free edition.  For one, it will get a lot more people to try REAL Studio.  Want to learn how to program? Use REAL Studio Free Edition.  Schools could implement REAL Studio at no cost to teach programming.  What a great way to get a ton of exposure!  And getting students hooked on programming with REAL Studio has some major long-term benefits.</p>
<p>Even better, wouldn&#8217;t it be great if REAL Studio Free Edition was included with all new Macs, Dells and even Ubuntu Linux?  Granted, it wouldn&#8217;t be free for REAL to do that, but think about how quickly it would increase the REAL Studio user base?</p>
<p>For the community, having a ton more people becoming aware of REAL Studio (and actually using it) would be a major boon.  There would be more people creating sample code, more people to buy your add-ons and more people to request your consulting services.  And for REAL, it means there would be more people that are now aware of REAL Studio and who might actually select it for their next project.  I am sure this would lead to additional sales.</p>
<p>Lastly, this would be a fabulous way to promote the new REAL Studio name and finally bury the REALbasic name once and for all.  There would be a ton of free press, publicity and overall good will that would be generated if REAL announced &#8220;REAL Studio Free Edition with OObasic&#8221;.</p>
<p>Anyway, those are my (highly opinionated) thoughts?  What do you think?</p>
<hr /><sup>1</sup> The makers of <a href="http://kbasic.com/">Kbasic</a> sell a product called <a href="http://www.objective-basic.com/">Objective-Basic</a> for Mac OS X.  But it requires the Apple SDK, Objective-C and Interface Builder.  The website says that &#8220;After all the syntax [of Objective-Basic] is very similar to REALbasic&#8221;.</p>
<p><sup>2</sup> See <a href="http://www.janus-software.com/phoenix_features.html">Phoenix Object Basic</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2010/02/real-studio-about-the-name-change/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Migrating from Visual Basic to REALbasic</title>
		<link>http://www.rbdevzone.com/2009/10/migrating-from-visual-basic-to-realbasic/</link>
		<comments>http://www.rbdevzone.com/2009/10/migrating-from-visual-basic-to-realbasic/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 19:16:08 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[VisualBasic]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/?p=286</guid>
		<description><![CDATA[This is an updated version of an article that originally appeared in REALbasic Developer Magazine 6.1 (Nov/Dec 2007).
You&#8217;ve all heard the news: Visual Basic is dead.  Support for Microsoft Visual Basic 6 has pretty much ended and you will soon be completely on your own.  Microsoft wants you to move to their powerful, [...]]]></description>
			<content:encoded><![CDATA[<p><cite>This is an updated version of an article that originally appeared in <a href="http://www.rbdeveloper.com/browse/6.1/">REALbasic Developer Magazine 6.1 (Nov/Dec 2007)</a>.</cite></p>
<p>You&#8217;ve all heard the news: Visual Basic is dead.  Support for Microsoft Visual Basic 6 has pretty much ended and you will soon be completely on your own.  Microsoft wants you to move to their powerful, but extremely complex .NET platform.</p>
<p>I can hear you all screaming &#8220;No!!!,  say it isn&#8217;t so&#8221;.  But it is so.  So what are your options?  The way I see it, you have these options:</p>
<ol>
<li>Tough it out with Visual Basic</li>
<li>Switch to .NET</li>
<li>Switch to something else</li>
<li>Migrate to REALbasic</li>
</ol>
<p>I&#8217;ll cover each of these options and hopefully convince that you should strongly consider REALbasic.</p>
<h2>Tough It Out with Visual Basic 6</h2>
<p>The easiest option is to just stick with the status quo and use Visual Basic as you have been for years.  It&#8217;s worked this far, why not keep using it?  Well, the world has not been standing still since Visual Basic 6 was released in 1998.  Vista is out now and VB6 does not have any Vista support, although applications seems to work fine with it.  For now.  Mac OS X and Linux are also a lot more common now, which might be something you should consider.</p>
<p>The IDE UI for VB6 is also dated.  It&#8217;s an MDI application with a bunch of Windows that are all over the place.  Frankly, it is a bit ugly to look at:</p>
<p><img src="http://www.rbdevzone.com/wp-content/uploads/2009/10/vb6.tiff" border="0" alt="vb6.tiff" width="444" height="344" /></p>
<p>And the VB6 language, although easy to learn, is also not all that powerful either.  For one thing, its object-oriented capabilities leave much to be desired.  It doesn&#8217;t have inheritance, for example.  You&#8217;re forced to use interfaces to work around it.</p>
<p>If you stick with VB, where will you get your support?  Microsoft ended mainstream VB support some time ago.  You can still get some support from them for a few more months if you&#8217;re willing to pay for it, but after that you&#8217;ll be on your own.</p>
<p>I don&#8217;t think that burying your head in the stand and continuing with VB6 is a good idea.</p>
<h2>Switch to .NET</h2>
<p>Microsoft recommends you switch to .NET, so it must be the way to go, right?  Don&#8217;t be too sure!  If you have never worked with .NET, switching from VB will be a daunting task.  The framework documentation is immense, so you&#8217;ll have a lot to learn.  A printed copy of the .NET 1.1 framework reference guide is over 2 feet tall.  .NET 3.5 is even larger!   And don&#8217;t forget that Microsoft is rolling out changes to .NET at a furious pace.  Visual Studio 2010 (with .NET 4.0) is now in beta and is scheduled for release in early 2010.  Each of these new versions adds lots of new features and lots of complexity.  It is hard to keep up.</p>
<p>Microsoft used to refer to the version of Visual Basic included with .NET as VB.NET.  Now they&#8217;ve taken to just calling it Visual Basic.  But even though it shares its name with Visual Basic 6, it is really an entirely new language and has almost nothing in common with VB6.  The language features and object model are completely different.  Microsoft does provide a migration tool, but it works about as well as any migration tool, which means &#8220;not well&#8221;.</p>
<p>And what about cost?  Sure, <a href="http://www.microsoft.com/express/vb/default.aspx">Visual Basic 2008 Express</a> is free, but it has a lot of limitations.  You&#8217;ll probably want to shell out for at least the Standard edition ($257 from Programmer&#8217;s Paradise), but probably the Professional edition ($696 from Programmer&#8217;s Paradise).</p>
<p>Switch to Something Else<br />
Of course, there are other choices as well.  You could always give <a href="http://www.embarcadero.com/products/delphi">Delphi 2010</a> a try, but it&#8217;s $900 for the Professional edition.  It&#8217;s also uses Pascal (albeit an object-oriented version).  I liked Pascal in the 80&#8217;s, but who seriously wants to work with it now?</p>
<p>You could also consider Java (recently bought by Oracle), but if you thought .NET is complicated you&#8217;re in for a real treat with Java.  The biggest benefits for Java is that nearly everything for it available for free.  The biggest downside is that you&#8217;ll spend much more time and money learning how to use than you would have spent by choosing another option.  And although Java is cross-platform, it takes a lot of work to create a UI that looks decent on multiple platforms.</p>
<h2>Migrate to REALbasic</h2>
<p>Now this just might make more sense!  The <a href="http://www.realsoftware.com">REALbasic</a> language should look quite familiar to VB programmers.  It is a different, though fully object-oriented, language, of course, but it is very easy to see how things are connected.  The REALbasic framework is well organized and easy to understand.  It&#8217;s also concise, so you can learn it all in a short time.</p>
<p>The IDE works great with multiple tabs as you would expect any modern development IDE to do.  Additionally, REALbasic is updated regularly (every 90 days, in fact).  And these updates are small and focused, so you can stay on top of the changes.</p>
<p>And I saved the best for last:  REALbasic is cross-platform!  REALbasic itself runs on Windows, Mac OS X and Linux and can create applications that run on Windows, Mac OS X and Linux.  You can do your development on whatever platform you prefer but deploy to the platforms your customers use.  And since you&#8217;re coming from VB, which is Windows-only, you can also grow your customer base by branching out beyond Windows, which might be significant depending on what your application does.</p>
<p>Check out accompanying sidebar for more information regarding REALbasic and Visual Basic.</p>
<h2>How to Get Started?</h2>
<p>Hopefully, you have now realized that <a href="http://realsoftware.com/realbasic/">REALbasic</a> ($100 for the Personal edition) is worth a look.  If you haven&#8217;t already, download the REALbasic trial for your platform.</p>
<p>Eventually you&#8217;ll want the Professional edition ($300), though, since it has advanced features such as Container Controls and cross-platform compiling.  New for 2009 is REAL Studio, which includes REALbasic Professional for all three platforms, additional support and a license to <a href="http://realsoftware.com/realsqlserver/">REAL Server</a> (their SQL database server).  At $1000, it is not cheap, but it does cost less than buying everything separately.</p>
<p>REAL Software also has a new tool, the <a href="http://realsoftware.com/download/">VB Migration Assistant</a>, available for free on their web site.  This tool migrates your VB code and controls to REALbasic.  The code itself is not changed (it simply migrates it as comments), but it is a great way to get your VB project into REALbasic so you can migrate it all in one place.</p>
<p>AYB Computers also  makes a tool to help with VB migrations.  Their product, VBConvert!, actually attempts to migrate all your code and controls.  At $50, it&#8217;s worth the investment.</p>
<p>Realistically, if you have a Visual Basic application and are thinking it should be moved to REALbasic, then you need to do a bit of analysis first.  No tool is going to magically make your VB project work 100% in REALbasic.</p>
<p>Ask yourself if your application needs to be an exact port or does it just need to replicate functionality?  In many cases, you can create a much better design in REALbasic than you could have with Visual Basic because REALbasic is a much more powerful language with better object-oriented capabilities.</p>
<p>Does your application make use of many 3rd party controls and libraries?  Not all of these will work with REALbasic, and even if they do they would prevent you from creating a cross-platform application.  Think about what your using and why.  Perhaps there are equivalent 3rd party controls available for REALbasic or perhaps you don&#8217;t really need them after all.</p>
<h2>What&#8217;s Similar to Visual Basic?</h2>
<p>As you might expect, Visual Basic and REALbasic have a lot of similarities.</p>
<p>Syntax<br />
As you might guess since both Visual Basic and REALbasic have &#8220;basic&#8221; in their name, the language syntax is very similar.  You&#8217;ll see familiar syntax for For..Next, While..Loop, If..Then..Else, Dim and many other commands.  You&#8217;ll have no trouble at all reading (or writing) REALbasic code.</p>
<h3>Data Types</h3>
<p>Although REALbasic&#8217;s data types are not always named exactly the same as the Visual Basic ones, all the equivalent types are there.  For example, the REALbasic Integer is equivalent to the VB Long (figure 3).</p>
<h3>Controls</h3>
<p>The default UI controls included with VB are, for the most part, also included with REALbasic (figure 4).</p>
<p>REALbasic also has several controls that are not included by default with VB (figure 5).  Of course, there are plenty of available controls for VB that can be added to its default setup.    REALbasic can use some of these 3rd party VB controls, but not all of them.</p>
<h2>What&#8217;s Different from Visual Basic?</h2>
<p>Of course, REALbasic also has quite a few differences from Visual Basic as well.</p>
<p>REALbasic cannot create DLLs, ActiveX controls or any kind of shared libraries.  Since these are all Windows-specific technologies, that is somewhat understandable.  You&#8217;ll either need to rethink your design here or just re-use these components from within REALbasic (and thus limiting yourself to just deploying on Windows).</p>
<p>As I&#8217;ve mentioned before, REALbasic is fully object-oriented.  Unlike VB, you can have real classes with real inheritance and other object-oriented properties.</p>
<h3>File I/O</h3>
<p>One of the biggest differences between VB and RB is file I/O.  REALbasic consolidates all its file processing into a few classes: FolderItem, TextInputStream, TextOutputStream and BinaryStream.  VB uses hard-coded file paths and less flexible file access methods, primarily because it is Windows-specific.  Any code that you have in VB that references files will need to be converted to use the equivalent REALbasic classes.</p>
<h3>Data Types</h3>
<p>REALbasic is strongly typed.  Visual Basic allows you to do some things the &#8220;old-school&#8221; BASIC way, the most significant of which is using variables without declaring them.  REALbasic does not allow this.  Use the OPTION EXPLICIT command in all your Visual Basic code to have VB enforce explicit variable declarations.</p>
<h2>Wrapping Up</h2>
<p>I think I&#8217;ve given you a lot to chew on in this overview. Give REALbasic a try; you&#8217;ll be glad you did!</p>
<hr />
<div>
<h3>Comparing Visual Basic and REALbasic</h3>
<h4>What&#8217;s Better About REALbasic?</h4>
<ul>
<li>The IDE</li>
<li>The language is more modern, more powerful and more consistent</li>
<li>Cross-platform</li>
<li>Supports Windows Vista</li>
<li>Updated regularly (every 90 days)</li>
<li>Internet classes for network, email, web services and more</li>
<li>Error handling</li>
<li>File I/O</li>
<li>Graphics handling (including 3-D and vector graphics)</li>
<li>Namespaces</li>
</ul>
<h4>What&#8217;s Better About Visual Basic?</h4>
<ul>
<li>Creating reports is much, much easier with Visual Basic, but REALbasic just added Reporting capability in REALbasic 2009 Release 4.</li>
<li>Many more 3rd party UI controls are available</li>
<li>Many more different (Windows-specific) project types</li>
<li>Object browser</li>
<li>Debugger (edit and continue)</li>
</ul>
</div>
<hr />
<h3>Figure 3: VB and RB Data Types</h3>
<table border="0">
<tbody>
<tr>
<th>VB Data Type</th>
<th>RB Data Type</th>
</tr>
<tr>
<td>Boolean</td>
<td>Boolean</td>
</tr>
<tr>
<td>Byte</td>
<td>Byte</td>
</tr>
<tr>
<td>Currency</td>
<td>Currency</td>
</tr>
<tr>
<td>Date</td>
<td>Date (Date is a class in REALbasic)</td>
</tr>
<tr>
<td>Double</td>
<td>Double</td>
</tr>
<tr>
<td>Integer</td>
<td>Short</td>
</tr>
<tr>
<td>Long</td>
<td>Integer</td>
</tr>
<tr>
<td>Object</td>
<td>Object</td>
</tr>
<tr>
<td>Single</td>
<td>Single</td>
</tr>
<tr>
<td>String</td>
<td>String</td>
</tr>
<tr>
<td>Variant</td>
<td>Variant</td>
</tr>
<tr>
<td>n/a</td>
<td>Color</td>
</tr>
<tr>
<td>n/a</td>
<td>Int64</td>
</tr>
<tr>
<td>n/a</td>
<td>UInt16</td>
</tr>
<tr>
<td>n/a</td>
<td>UInt32</td>
</tr>
<tr>
<td>n/a</td>
<td>UInt64</td>
</tr>
</tbody>
</table>
<hr />
<h3>Figure 4: VB Controls and equivalent RB Controls</h3>
<table border="0">
<tbody>
<tr>
<th>VB Control</th>
<th>Equivalent RB Control</th>
</tr>
<tr>
<td>PictureBox</td>
<td>Canvas</td>
</tr>
<tr>
<td>Label</td>
<td>StaticText</td>
</tr>
<tr>
<td>TextBox</td>
<td>TextField</td>
</tr>
<tr>
<td>Frame</td>
<td>GroupBox</td>
</tr>
<tr>
<td>CommandButton</td>
<td>PushButton, BevelButton</td>
</tr>
<tr>
<td>CheckBox</td>
<td>CheckBox</td>
</tr>
<tr>
<td>OptionButton</td>
<td>RadioButton</td>
</tr>
<tr>
<td>ComboBox</td>
<td>ComboBox</td>
</tr>
<tr>
<td>Listbox</td>
<td>Listbox, PopupMenu</td>
</tr>
<tr>
<td>HScrollBar</td>
<td>ScrollBar</td>
</tr>
<tr>
<td>VScrollBar</td>
<td>ScrollBar</td>
</tr>
<tr>
<td>Timer</td>
<td>Timer</td>
</tr>
<tr>
<td>DriveListBox</td>
<td>n/a</td>
</tr>
<tr>
<td>DirListBox</td>
<td>n/a</td>
</tr>
<tr>
<td>FileListBox</td>
<td>n/a</td>
</tr>
<tr>
<td>Shape</td>
<td>Oval, Rectangle, RoundRectangle</td>
</tr>
<tr>
<td>Line</td>
<td>Line</td>
</tr>
<tr>
<td>Image</td>
<td>ImageWell</td>
</tr>
<tr>
<td>Data</td>
<td>DatabaseQuery, DataControl</td>
</tr>
<tr>
<td>OLE</td>
<td>OLEContainer</td>
</tr>
<tr>
<td>RichTextBox</td>
<td>TextArea</td>
</tr>
<tr>
<td>TabStrip</td>
<td>TabPanel</td>
</tr>
<tr>
<td>WebBrowser</td>
<td>HTMLViewer</td>
</tr>
<tr>
<td>MSFlexGrid</td>
<td>ListBox</td>
</tr>
<tr>
<td>WindowsMediaPlayer</td>
<td>MoviePlayer</td>
</tr>
<tr>
<td>ProgressBar</td>
<td>ProgressBar</td>
</tr>
<tr>
<td>Toolbar</td>
<td>Toolbar</td>
</tr>
<tr>
<td>StatusBar</td>
<td>n/a</td>
</tr>
<tr>
<td>Slider</td>
<td>Slider</td>
</tr>
<tr>
<td>TreeView</td>
<td>ListBox</td>
</tr>
<tr>
<td>ListView</td>
<td>n/a</td>
</tr>
<tr>
<td>ImageCombo</td>
<td>n/a</td>
</tr>
<tr>
<td>ImageList</td>
<td>n/a</td>
</tr>
</tbody>
</table>
<hr />
<h3>Figure 5: RB controls not included with VB by default</h3>
<ul>
<li>DisclosureTriangle</li>
<li>NotePlayer</li>
<li>PagePanel</li>
<li>Placard</li>
<li>PopupArrow</li>
<li>ProgressWheel</li>
<li>Rb3DSpace</li>
<li>RbScript</li>
<li>Separator</li>
<li>Serial</li>
<li>ServerSocket</li>
<li>SpotlightQuery</li>
<li>SpriteSurface</li>
<li>TCPSocket</li>
<li>UDPSocket</li>
<li>UpDownArrows</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2009/10/migrating-from-visual-basic-to-realbasic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CallByName Function</title>
		<link>http://www.rbdevzone.com/2009/09/callbyname-function/</link>
		<comments>http://www.rbdevzone.com/2009/09/callbyname-function/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 18:45:21 +0000</pubDate>
		<dc:creator>Paul Lefebvre</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[VisualBasic]]></category>

		<guid isPermaLink="false">http://www.rbdevzone.com/?p=276</guid>
		<description><![CDATA[A post in the REAL Software forums asked if REALbasic has a CallByName function like VB has.  After reviewing my answer and the CallByName function in VB, I am presenting a more thorough solution here.
First, REALbasic does not have CallByName.  However, it does have Introspection (aka reflection) which can be used to achieve [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://forums.realsoftware.com/viewtopic.php?f=13&amp;t=29303">post</a> in the REAL Software forums asked if REALbasic has a CallByName function like VB has.  After reviewing my answer and the CallByName function in VB, I am presenting a more thorough solution here.</p>
<p>First, REALbasic does not have CallByName.  However, it does have Introspection (aka <a href="http://en.wikipedia.org/wiki/Reflection_(computer_science)">reflection</a>) which can be used to achieve this.</p>
<p>The official function definition in VB is:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">CallByName(<span style="color: #000080;">object</span> <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>, procname <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, calltype <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>, [args() <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>])</pre></div></div>

<p>This is a bit limited as it cannot handle return values.  I&#8217;d also prefer a more object-oriented syntax.  So our REALbasic definitions are:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Object</span>.CallByName(name <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, nameType <span style="color: #000080;">As</span> CallType, <span style="color: #000080;">ParamArray</span> args <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>)
<span style="color: #000080;">Object</span>.CallByName(name <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, nameType <span style="color: #000080;">As</span> CallType, <span style="color: #000080;">ParamArray</span> args <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span></pre></div></div>

<p>In order for this to be usable on any object, we&#8217;ll implement these as extension methods.  First we need to create a module to contain our methods.  Create a module called <strong>CallByNameExtension</strong>.  This self-contained module will eventually have everything we need to use CallByName in our projects.</p>
<p>Next, we need to create the CallType enumeration.  This is used to specify the type of the we want to call.  Our options are Method, PropertyGet and PropertySet.  On our module, create a CallType enumeration with those three values (Method, PropertyGet, PropertySet).</p>
<p>Now create our two method signatures for CallByName:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Sub</span> CallByName(Extends obj <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>, name <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, nameType <span style="color: #000080;">As</span> CallType, <span style="color: #000080;">ParamArray</span> args <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>)
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Function</span> CallByName(Extends obj <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>, name <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, nameType <span style="color: #000080;">As</span> CallType, <span style="color: #000080;">ParamArray</span> args <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<p>Since both of these methods will actually use very similar code, we will create a private worker method to actually do the call.  Create a new private method:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Private</span> <span style="color: #000080;">Function</span> CallByNameWorker(obj <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>, name <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, nameType <span style="color: #000080;">As</span> CallType, args() <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<p>Note that we&#8217;ve changed the ParamArray to just a simple array.  This is because we cannot resend the parameters as a ParamArray.</p>
<p>Let&#8217;s add the simple code to the public methods:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Sub</span> CallByName(Extends obj <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>, name <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, nameType <span style="color: #000080;">As</span> CallType, <span style="color: #000080;">ParamArray</span> args <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>)
&nbsp;
   <span style="color: #000080;">Call</span> CallByNameWorker(obj, name, nameType, args)
&nbsp;
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Function</span> CallByName(Extends obj <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>, name <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, nameType <span style="color: #000080;">As</span> CallType, <span style="color: #000080;">ParamArray</span> args <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>
&nbsp;
  Return CallByNameWorker(obj, name, nameType, args)
&nbsp;
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<p>As you can see, this code simply calls the worker, saving the return value if appropriate.  Since ParamArrays are converted to real arrays, we can just pass that along to the worker as well.</p>
<p>In the worker method we&#8217;ll use Introspection to actually call the method or to get/set the value of the property.  Here is the code:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Private</span> <span style="color: #000080;">Function</span> CallByNameWorker(obj <span style="color: #000080;">As</span> <span style="color: #000080;">Object</span>, name <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>, nameType <span style="color: #000080;">As</span> CallType, args() <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>
  <span style="color: #000080;">If</span> obj &lt;&gt; Nil <span style="color: #000080;">Then</span>
&nbsp;
    <span style="color: #000080;">Dim</span> info <span style="color: #000080;">As</span> Introspection.TypeInfo
    info = Introspection.GetType(obj)
&nbsp;
    <span style="color: #000080;">Select</span> <span style="color: #000080;">Case</span> nameType
    <span style="color: #000080;">Case</span> CallType.Method
      // <span style="color: #000080;">Get</span> the names of all the methods <span style="color: #000080;">on</span> the <span style="color: #000080;">object</span>
      <span style="color: #000080;">Dim</span> methods() <span style="color: #000080;">As</span> Introspection.MethodInfo
      methods = info.GetMethods
&nbsp;
      // Search <span style="color: #000080;">for</span> the specified method
      <span style="color: #000080;">For</span> <span style="color: #000080;">Each</span> m <span style="color: #000080;">As</span> Introspection.MethodInfo <span style="color: #000080;">In</span> methods
        <span style="color: #000080;">If</span> m.Name = name <span style="color: #000080;">Then</span>
          // We found it, so <span style="color: #000080;">call</span> it
          <span style="color: #000080;">Dim</span> rv <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>
          rv = m.Invoke(obj, args)
&nbsp;
          Return rv
        <span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
      <span style="color: #000080;">Next</span>
&nbsp;
    <span style="color: #000080;">Case</span> CallType.PropertyGet
      // <span style="color: #000080;">Get</span> the names of all the properties <span style="color: #000080;">on</span> the <span style="color: #000080;">object</span>
      <span style="color: #000080;">Dim</span> props() <span style="color: #000080;">as</span> Introspection.PropertyInfo
      props = info.GetProperties
&nbsp;
      // Search <span style="color: #000080;">for</span> the specified <span style="color: #000080;">property</span>
      <span style="color: #000080;">For</span> <span style="color: #000080;">Each</span> p <span style="color: #000080;">As</span> Introspection.PropertyInfo <span style="color: #000080;">In</span> props
        <span style="color: #000080;">If</span> p.Name = name <span style="color: #000080;">Then</span>
          // We found it, so return its value
          <span style="color: #000080;">Dim</span> value <span style="color: #000080;">As</span> <span style="color: #000080;">Variant</span>
          value = p.Value(obj)
&nbsp;
          Return value
        <span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
      <span style="color: #000080;">Next</span>
&nbsp;
    <span style="color: #000080;">Case</span> CallType.PropertySet
      // <span style="color: #000080;">Get</span> the names of all the properties <span style="color: #000080;">on</span> the <span style="color: #000080;">object</span>
      <span style="color: #000080;">Dim</span> props() <span style="color: #000080;">as</span> Introspection.PropertyInfo
      props = info.GetProperties
&nbsp;
      // Search <span style="color: #000080;">for</span> the specified <span style="color: #000080;">property</span>
      <span style="color: #000080;">For</span> <span style="color: #000080;">Each</span> p <span style="color: #000080;">As</span> Introspection.PropertyInfo <span style="color: #000080;">In</span> props
        <span style="color: #000080;">If</span> p.Name = name <span style="color: #000080;">Then</span>
          // We found it so <span style="color: #000080;">set</span> its value <span style="color: #000080;">to</span> the first argument
          p.Value(obj) = args(0)
        <span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
      <span style="color: #000080;">Next</span>
    <span style="color: #000080;">End</span> <span style="color: #000080;">Select</span>
&nbsp;
  <span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
Exception e <span style="color: #000080;">As</span> RuntimeException
  <span style="color: #000080;">Dim</span> eInfo <span style="color: #000080;">As</span> Introspection.TypeInfo
  eInfo = Introspection.GetType(e)
&nbsp;
  <span style="color: #000080;">Dim</span> eMessage <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
  eMessage = <span style="color: #800000;">&quot;A &quot;</span> + eInfo.FullName + <span style="color: #800000;">&quot; occurred.&quot;</span>
  <span style="color: #000080;">If</span> e.Message &lt;&gt; <span style="color: #800000;">&quot;&quot;</span> <span style="color: #000080;">Then</span>
    eMessage = eMessage + EndOfLine + <span style="color: #800000;">&quot;Message: &quot;</span> + e.Message
  <span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
  MsgBox(eMessage)
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<p>This code has one significant limitation when it comes to calling methods:  it cannot handle overloaded methods.  If you have multiple methods with the same name, but with different parameters, then this code will not always call the method you expect.  In order to fix this we would have to compare the types of each of the supplied arguments with the types of the arguments for each matching method and then call the one where everything matches.  This is all possible using Introspection, but I&#8217;ll leave it as an exercise for the reader.</p>
<p>Download the project with all the code: <a title="CallByName.rbp.zip" href="http://www.rbdevzone.com/wp-content/uploads/2009/09/CallByName.rbp.zip">CallByName.rbp.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rbdevzone.com/2009/09/callbyname-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
