<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://addressof.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>AddressOf.com</title><link>http://addressof.com/blog/default.aspx</link><description>VB.NET and Windows Forms</description><dc:language>en</dc:language><generator>CommunityServer 2.1 (Build: 60809.935)</generator><item><title>GW-BASIC 0.1.4</title><link>http://addressof.com/blog/archive/2012/05/03/GW_2D00_BASIC-0.1.4.aspx</link><pubDate>Thu, 03 May 2012 04:00:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746811</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746811.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746811</wfw:commentRss><description>&lt;p&gt;I&amp;#39;ve made a few enhancements to the interpreter..&lt;/p&gt;&lt;ul&gt;&lt;li&gt;There is now a branding/navigation bar across the top.&amp;nbsp; This provides the ability to visit this website and access to additional functionality.&lt;/li&gt;&lt;li&gt;The files button (in the navigation bar) provides for a more modern UI over the 1980&amp;#39;s era GW-BASIC commands FILES, CHDIR, RMDIR, LOAD, RUN and KILL.&amp;nbsp; Folders are in bold where files are normal.&amp;nbsp; The .. (period period) entry provides a means to easily CHDIR up one level.&amp;nbsp; This is essentially a direct port of the work I&amp;#39;m doing for the Window Phone version.&lt;/li&gt;&lt;li&gt;CTRL+V and CTRL+X in direct mode will interact with the OS clipboard for copy/paste support.&amp;nbsp;&amp;nbsp;CTRL+V (paste) will&amp;nbsp;pipe whatever is in the clipboard into the interactive interpreter; in other words, it will emulate typing in the characters into&amp;nbsp;direct mode of the interpreter.&amp;nbsp; CTRL+X (transfer to clipboard) will take the&amp;nbsp;in memory source code and copy it to the clipboard.&lt;/li&gt;&lt;li&gt;Thanks&amp;nbsp;to feedback, someone has provided me with several&amp;nbsp;key codes that are used on OSX;&amp;nbsp;so I think I&amp;#39;m getting a lot closer to having the keybindings working correctly on Macintosh machines.&lt;/li&gt;&lt;li&gt;The SYSTEM keyword has been modified so that it will PRINT various environment information so that globalization and localization can be handled going forward.&lt;/li&gt;&lt;li&gt;On systems that have different keyboard scan codes, the interpreter will print acknowledge this key being pressed with the associated key code.&amp;nbsp; This is used to assist in creating the appropriate keybindings; so keep sending in the feedback.&lt;/li&gt;&lt;li&gt;&lt;a href="http://justsomevbcode.blogspot.com/"&gt;Adam Zuckerman&lt;/a&gt; pointed out issues with RENUM and LINE INPUT.&amp;nbsp; LINE INPUT has been resolved and the RENUM one is &amp;quot;sort of&amp;quot; resolved.&amp;nbsp; It &amp;quot;works&amp;quot;, however, I&amp;#39;d like to spend more time on this in the future.&amp;nbsp; He also brought up the copy/paste idea; which I thought about previously but set aside since it wasn&amp;#39;t within scope.&amp;nbsp; However, he sent in several code snippets via email and lack of having the ability to copy from email and paste into the interpreter was a right royal pain... so problem had to be solved. ;-)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Additionally, several people pointed out that couldn&amp;#39;t find where to join this site; as it turns out, it was turned off.&amp;nbsp; Doh!&amp;nbsp; This has been corrected and you can join by using the link in the upper right hand corner of the screen.&lt;/p&gt;&lt;p&gt;Thanks to the amazing number of emails; please keep the feedback going.&amp;nbsp; It&amp;#39;s amazing how many people have had positive things to say.&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746811" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/BASIC/default.aspx">BASIC</category></item><item><title>GW-BASIC</title><link>http://addressof.com/blog/archive/2012/04/29/GW_2D00_BASIC.aspx</link><pubDate>Sun, 29 Apr 2012 05:32:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746806</guid><dc:creator>CorySmith</dc:creator><slash:comments>9</slash:comments><comments>http://addressof.com/blog/comments/746806.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746806</wfw:commentRss><description>&lt;p&gt;I&amp;#39;ve been working hard since I got back from England on all aspects of the interpreter.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Language&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;For the most part, I think I have most&amp;nbsp;of the language covered.&amp;nbsp;&amp;nbsp;I&amp;#39;ve added a few extra keywords; however, the primary purpose is the have as much compatibility with the&amp;nbsp;original as possible.&amp;nbsp; Most of these have been implemented using the documentation as a reference; however, it has become apparent that the documentation might not be as accurate as actually running the code in the original.&amp;nbsp; So I&amp;#39;m&amp;nbsp;constantly finding cases where tweaks are having to be done to accomidate the differences between what the documentation states and&amp;nbsp;what the original version actually does.&amp;nbsp; With that said, everyday there seems to be less and less of these differences.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Editor&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Spent a bit of time working on the &amp;quot;editor&amp;#39;&amp;nbsp;in an effort to have it work similarly to the original; including a few quirks since some samples seem to rely on these in order to accomplish animations.&amp;nbsp; I&amp;nbsp;hear what your thinking; animations and the editor?&amp;nbsp; Yes, the last line (line 25) is treated as a special&amp;nbsp;case in&amp;nbsp;not only in&amp;nbsp;edit mode but at runtime.&amp;nbsp; I had to do a bit of&amp;nbsp;rework&amp;nbsp;in order to accomidate this quirky behavior;&amp;nbsp;but I think I&amp;#39;ve got a handle on&amp;nbsp;it.&amp;nbsp; Tests&amp;nbsp;I&amp;#39;ve managed to&amp;nbsp;put together are producing similar results.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;DOS 1.1&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I have the majority of the samples included with DOS 1.1 working; without sound.&amp;nbsp; More on this in a moment.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Graphics&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I think I have full support for CGA and EGA level graphics&amp;nbsp;nearly completed.&amp;nbsp; This includes colors, palette, pcopy, get, put, etc.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;File System&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;ve stepped back from the web service based file system and have since replaced it with isolated storage and applied this to both the&amp;nbsp;Silverlight and Windows Phone versions.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Improved Performance&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks in part to my visit to Redgate, I&amp;#39;ve been able to use the ANTS Performance Profiler to narrow in on where some of the performance issues exist in my interpreter.&amp;nbsp; Using this information, I was able to increase the overall performance by about 50% in the Silverlight version.&amp;nbsp; Experimenting with the Windows Phone version, I found that the majority of the performance issues were with how the screen is being refreshed; not necessarily in the actual interpreter.&amp;nbsp; After discussing the issue with Chris Koenig; he offered a suggesstion that, after a bit of research and experimentation, took everything to a whole new level by splitting the drawing between two different phases.&amp;nbsp; This model has also been applied to the Silverlight version and seems to work pretty well.&amp;nbsp; In the end, if you haven&amp;#39;t looked at the ANTS Performance Profiler... take a moment to do so.&amp;nbsp; It&amp;#39;s an awesome product!&amp;nbsp;&amp;nbsp; I have nothing but nice things to say about the product, the team members that work on it and shared their insights with me and thanks to Redgate for playing host while I was in England.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Windows Phone 7&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;ve built a basic UI for the Windows Phone that works to make the DOS interface more user friendly in a thumb based device while still holding true to the original.&amp;nbsp; There is definately more that I can do; however, for now it seems to be a good start.&amp;nbsp; It now includes pinching and movement on the display surface, a special keys panel for keys not included on the phone interface, a basic UI that sits on top of the interpreters built in commands for file management that allows you to browse and manage through a more modern touch friendly interface and common commands available through the application bar and menus, basic support for tombstoning, prompting against accidental closure, isolated storage used for virtual file system, landscape or portrait layout&amp;nbsp;and, as already mentioned, significant performance improvements.&amp;nbsp; I think I&amp;#39;m going to try to submit it for publication in the marketplace this coming week.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Silverlight&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Still using Silverlight 4 at this point; however, given a few recent developments, I may be moving this to Silverlight 5 very soon.&amp;nbsp; I&amp;#39;m hoping that the sound api&amp;#39;s included in v5 will go a long way to remedy the shortcomings that I&amp;#39;ve experienced previously.&amp;nbsp; I think these api&amp;#39;s also are available on the phone, however haven&amp;#39;t had a chance to reallly dig in.&amp;nbsp; I&amp;#39;ve also added the ability to drag and drop a .BAS file directly onto the surface and the interpreter will load the script into memory and execute it immediately.&amp;nbsp; A real time saver for files that you may have available already (or download).&amp;nbsp; I&amp;#39;d like to get copy/paste support working; however, my initial attempts are a little disappointing due to the security protections in place making the process a little clunky.&amp;nbsp; I&amp;#39;m also going to look into adding a &amp;quot;Save As&amp;quot; feature and a &amp;quot;Open&amp;quot; feature that allow you to import/export .BAS files using the standard windows most people are already accustomed to.&amp;nbsp; One last addition is, which most likely change, the addition of a &amp;quot;speed up&amp;quot; poke.&amp;nbsp; By default the interpreter processes a batch of statements per cycle; which right now is around 60.&amp;nbsp; Using this POKE, it&amp;#39;s possible to modify how many are being processed each pass from 1 to a little over 1000.&amp;nbsp; So the default setting is POKE 0, 15 where the 0 is the address used and 15 is 1/4th of the processed statements per cycle.&amp;nbsp; POKE 0,0 will process 1 statement per pass.&amp;nbsp; Really, really slow; however, great for debugging the interpreter.&amp;nbsp; The current setting seems to be pretty close to what DosBox is running GW-BASIC.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Sound&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;ve already touched on this a little.&amp;nbsp; It seems that all of the best examples have sound to one degree or another.&amp;nbsp; I&amp;#39;ve got a lot of work in this aready to get done, which starts with the simple BEEP statement.&amp;nbsp;&amp;nbsp;What is implemented at this point is&amp;nbsp;close, but&amp;nbsp;I need to modify it to be a square wave.&amp;nbsp; The&amp;nbsp;SOUND statement plays sound; however, does not&amp;nbsp;incude the&amp;nbsp;blocking async behavior of the original which appears to be utilized by many samples as&amp;nbsp;a means of&amp;nbsp;CPU throttling in loops.&amp;nbsp;&amp;nbsp;Finally, the&amp;nbsp;last known issue is that sounds less than 2/10ths of a second appear to not produce any&amp;nbsp;noise in Silverlight.&amp;nbsp;&amp;nbsp;Once&amp;nbsp;I solve these issues, I&amp;#39;ll be able to work on implementing the Music Programming Language in order to finish the&amp;nbsp;PLAY statement and&amp;nbsp;the associated&amp;nbsp;ON related&amp;nbsp;functionality.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Where can you start playing with the work in progress?&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.addressof.com/basic/"&gt;http://www.addressof.com/basic/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746806" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/BASIC/default.aspx">BASIC</category></item><item><title>Cambridge, England, UK</title><link>http://addressof.com/blog/archive/2012/03/19/Cambridge_2C00_-England_2C00_-UK.aspx</link><pubDate>Mon, 19 Mar 2012 13:57:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746805</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746805.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746805</wfw:commentRss><description>&lt;p&gt;Next Monday, I&amp;#39;ll be headed to the UK (Cambridge) for a &amp;quot;vacation&amp;quot;.&amp;nbsp; As it turns out, this is also the home of &lt;a href="http://www.red-gate.com"&gt;Red Gate&lt;/a&gt; software, makers of &lt;a href="http://www.red-gate.com/products/sql-development/sql-toolbelt/"&gt;SQL Toolbelt&lt;/a&gt;, &lt;a href="http://www.red-gate.com/products/dotnet-development/dotnet-developer-bundle/"&gt;ANTS Profiler&lt;/a&gt; and &lt;a href="http://www.reflector.net/"&gt;.NET Reflector&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;I&amp;#39;ll be spending some time with them while there; so if you have any questions / comments you&amp;#39;d like me to pass along, feel free to send them my direction.&lt;/p&gt;&lt;p&gt;I&amp;#39;m not, in the slightest, embarrased to admit that I&amp;#39;m pretty excited to hang out with the team now responsible for &lt;a href="http://www.reflector.net/"&gt;.NET Reflector&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746805" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/General/default.aspx">General</category><category domain="http://addressof.com/blog/archive/tags/Tools/default.aspx">Tools</category><category domain="http://addressof.com/blog/archive/tags/Geek+Gathering/default.aspx">Geek Gathering</category><category domain="http://addressof.com/blog/archive/tags/TSQL/default.aspx">TSQL</category><category domain="http://addressof.com/blog/archive/tags/redgate/default.aspx">redgate</category></item><item><title>End of year wrap up (2011)</title><link>http://addressof.com/blog/archive/2011/12/24/End-of-year-wrap-up-_2800_2011_2900_.aspx</link><pubDate>Sat, 24 Dec 2011 04:36:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746785</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746785.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746785</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;&lt;u&gt;BLOG&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;m currently in the planning stages to rebuild this site.&amp;nbsp; I&amp;#39;ve delayed doing this for a long time since I didn&amp;#39;t want to &amp;quot;break links&amp;quot;; however, one reason why I don&amp;#39;t contribute as much as I used to is the fact that I enjoy the comment interaction.&amp;nbsp; Thanks to blog spam, I had to disable anonymous comments and, since that time, my posts have slowed way down.&amp;nbsp; (Yes, CAPTCHA controls exist; however, it&amp;#39;s not that straight forward to implement on this now aging copy of community server.)&amp;nbsp; So, I&amp;#39;ve made the decision that it is time to do whatever is necessary to kick start things back into full gear and if this means that web links are broken in the process... so be it.&amp;nbsp; I&amp;#39;ll investigate ways to accommodate the change; however, at the end, it&amp;#39;s time to get&amp;#39;r&amp;#39;done.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Movie Jukebox&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;For those following along (for a while), I have another pet project that I built for my own purposes and have enjoyed the fruits of since that time.&amp;nbsp; I have four 400 disc DVD players connected to Media Center that allow me to choose among 1600 movies at the press of a button; and the overall cost of the hardware is amazingly small in comparison to other options.&amp;nbsp; I was recently approached by a long time friend regarding his desire to attempt to market the project and we made our first sale last week!&amp;nbsp; It&amp;#39;s officially a product now!!!!&amp;nbsp;  For full disclosure, I did have to address a few issues that I was ignoring (I knew what I was doing after all) and made a few enhancements to actually productize it for  a v1.0 release.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Fort Worth .NET Users Group&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;ve been knee deep in working to get the FWDNUG on track now that I&amp;#39;m the acting president.&amp;nbsp; Let&amp;#39;s just say that it&amp;#39;s been an adventure up to this point; however, I think things are starting to really come together and 2012 is starting to look like a very good year for the members of the group!&lt;/p&gt;&lt;p&gt;I also want to say how much fun the end-of-year party was; how often can one say that thanks to a .NET users group I got to shoot an AR-15, an AK-47 and a Colt .45! :-D&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;VB6 -&amp;gt; VB10 Comparison&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Look for additional entries on this to come in the first part of January.&amp;nbsp; Additionally, once VB11 is made available, I&amp;#39;ll be sure to do a follow up for any items that are appropriate.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;BASIC&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The pet project is still moving nicely along.&lt;/p&gt;&lt;p&gt;Parser/Interpreter &lt;/p&gt;&lt;p&gt;I think I&amp;#39;ve pretty much gotten the parsing and interpreter where I&amp;#39;d like to see it; at least for this project.  The performance is pretty good and works pretty&amp;nbsp;well on Windows Phone 7.&lt;/p&gt;&lt;p&gt;Portable Library&lt;/p&gt;&lt;p&gt;My decision to switch to the portable library project was, as far as I&amp;#39;m concerned, a very good one.  It does force me to have to think through how I&amp;#39;m going to implement portions of the project so that implementation can be segmented across different platforms, which at times can be a bit daunting in the midst of &amp;quot;just getting it done&amp;quot;.  However, even with the additional work that is involved, I do believe that the results are paying off.&lt;/p&gt;&lt;p&gt;Display&lt;/p&gt;&lt;p&gt;The &amp;quot;IDE&amp;quot; portions is pretty much 100% as well as most of the ANSI style &amp;quot;graphics&amp;quot;.  Additionally, CGA mode is mostly complete (except for my new arch enemy... CIRCLE).  As a follow up to the last post, the &amp;quot;last line issue&amp;quot; has been resolved by&amp;nbsp;no longer trying to reproduce the behavior of the original GW-BASIC... which is something that seems to be impossible because two different versions of GW-BASIC did it two different ways... so I decided to &amp;quot;fix the bug&amp;quot; and move on.&lt;/p&gt;&lt;p&gt;Keyboard&lt;/p&gt;&lt;p&gt;Working pretty well; however, I think I&amp;#39;m going to re-address this at a later time so that it is based on &amp;quot;scan codes&amp;quot; at a lower level and works across the various keyword appropriately.&lt;/p&gt;&lt;p&gt;File System&lt;/p&gt;&lt;p&gt;The file system over web services idea is working pretty well; however, there are significant issues that I&amp;#39;ve encountered due to a budget host environment.  Since my last post, I am now interested in attempting to build this over SkyDrive... so we&amp;#39;ll see where this goes as we move into the new year.&lt;/p&gt;&lt;p&gt;Sound&lt;/p&gt;&lt;p&gt;Silverlight 5 has been released, so now I can see if the improvements to low-level sound will help solve some of the issues I was facing.  I&amp;#39;ll update once I know more.&lt;/p&gt;&lt;p&gt;Keywords&lt;/p&gt;&lt;p&gt;As of this writing, 176 keywords have been implemented. For the most part, the majority of these keywords is pretty complete.  &lt;/p&gt;&lt;p&gt;Compatibility&lt;/p&gt;&lt;p&gt;All of the code that I&amp;#39;ve attempted to execute from the BASIC Computer Games - Microcomputer Edition book (c. 1979) works great.&amp;nbsp; I&amp;#39;ve been playing&amp;nbsp;Hunt the Wumpus;&amp;nbsp;that sure brings back a few memories. ;-)&amp;nbsp;&lt;/p&gt;&lt;p&gt;One of my original stated goals was to get this to the point where the original, unmodified, DONKEY.BAS code would execute as close to the original as possible.  As of this writing, the game can execute with only one minor modification to the original code; the culprit at this point is the SOUND statement, of which I&amp;#39;ve already mentioned I&amp;#39;m having to get a bit creative to solve.  The issue is not whether or not it can play sound; the SOUND statement was used as a means to throttle the game loop, which means I need to get my sound statement working the same.&amp;nbsp; In a world (Silverlight) where everything seems to want to be async, it&amp;#39;s proves to be a little bit of a problem but I think I&amp;#39;ve got a solution worked out.&amp;nbsp; Once done, the goal is to get all the original .BAS files included with DOS version 1.1 working.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Another interesting tidbit is that modifications had to be made to accommodate the actual sample code instead of relying 100% on the official documentation which neglects to mention a few quirks that I knew all those years ago but have since forgotten; such as the &amp;quot;optional&amp;quot; end quotation on string literals.  If it&amp;#39;s in the documentation, I couldn&amp;#39;t find it by scanning over it.&lt;/p&gt;&lt;p&gt;Summary&lt;/p&gt;&lt;p&gt;I&amp;#39;m still having a blast working on this project and can&amp;#39;t wait to see where it will lead.  It&amp;#39;s so much more fun now that it&amp;#39;s to the the point where the original code comes to life.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Be sure, I have a few other tidbits that I&amp;#39;m working on and a ton of ideas that I&amp;#39;m working through with regards to this site; so stay tuned.&amp;nbsp; Let&amp;#39;s just say if 2012 is the year the world comes to an end... I&amp;#39;ve got a lot of stuff on my plate that I want to accomplish before hand. ;-)&amp;nbsp; In all seriousness, I look forward to 2012 and hope that everyone enjoys success and prosperity in the new year.&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746785" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/General/default.aspx">General</category><category domain="http://addressof.com/blog/archive/tags/VB/default.aspx">VB</category><category domain="http://addressof.com/blog/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://addressof.com/blog/archive/tags/Geek+Gathering/default.aspx">Geek Gathering</category><category domain="http://addressof.com/blog/archive/tags/Community+Server/default.aspx">Community Server</category><category domain="http://addressof.com/blog/archive/tags/Windows/default.aspx">Windows</category><category domain="http://addressof.com/blog/archive/tags/Random/default.aspx">Random</category><category domain="http://addressof.com/blog/archive/tags/User+Group/default.aspx">User Group</category><category domain="http://addressof.com/blog/archive/tags/Media+Center/default.aspx">Media Center</category><category domain="http://addressof.com/blog/archive/tags/Presentations/default.aspx">Presentations</category><category domain="http://addressof.com/blog/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category><category domain="http://addressof.com/blog/archive/tags/BASIC/default.aspx">BASIC</category></item><item><title>BASIC - Status as of 2011-07-27</title><link>http://addressof.com/blog/archive/2011/07/27/BASIC-_2D00_-Status-as-of-2011_2D00_07_2D00_27.aspx</link><pubDate>Wed, 27 Jul 2011 16:54:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746781</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746781.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746781</wfw:commentRss><description>&lt;p&gt;Wow!&amp;nbsp; It&amp;#39;s been a month since my last update regarding this pet project.&amp;nbsp; To be fair, I did go on vacation for a week, so it&amp;#39;s really only been about 3 weeks of spare time effort on this.&amp;nbsp; With that said, I think it&amp;#39;s moving along at a rather excellent pace.&lt;/p&gt;&lt;p&gt;Parser&amp;nbsp;&lt;/p&gt;&lt;p&gt;Additional work done to the parser.&amp;nbsp; Decided to remove a lot of the validation and treat this layer as more of a tokenizer that can then be further validated at the interpreter level.&lt;/p&gt;&lt;p&gt;Portable Library&lt;/p&gt;&lt;p&gt;After getting everything working in Silverlight and continuing the project for several weeks, I recently attempted to get the interpreter working in Windows Phone 7.&amp;nbsp; I created a new project and copied over the code.&amp;nbsp; Tons of errors.&amp;nbsp; Several VB language features not available, more .NET Framework elements MIA and slight differences with Silverlight implementation on both devices.&amp;nbsp; I remembered a discussion about a relatively new project call the Portable Library Project.&amp;nbsp; After getting the correct service packs and such, was able to create a Portable Library version of the interpreter which required that I split several pieces out (and up) to a platform specific layer.&amp;nbsp; The portions are labeled as Display, Keyboard, Sound and File System.&amp;nbsp; Once done, I now have a core assembly that is capable of being leveraged across .NET 4, Silverlight 4, Windows Phone 7 and Xbox 360 (in theory).&lt;/p&gt;&lt;p&gt;Display&lt;/p&gt;&lt;p&gt;A lot of work was still to be done since the last update in order to fully handle the &amp;quot;IDE&amp;quot; aspects; mostly related to what I&amp;#39;m calling &amp;quot;last line issues&amp;quot;.&lt;/p&gt;&lt;p&gt;Keyboard&lt;/p&gt;&lt;p&gt;OK, I thought Silverlight was limited with regards to intercepting and working with the keyboard.&amp;nbsp; Wow!&amp;nbsp; Windows Phone 7... you&amp;#39;re my new worst enemy.&amp;nbsp; Why do you have a KeyUp/KeyDown event yet never can tell me the state of the Shift key?&amp;nbsp; I had to work a serious hack that takes 50+ lines of code to do what should realistically be less than 3.&lt;/p&gt;&lt;p&gt;I also had to handle the concept of a key buffer so that &amp;quot;type ahead&amp;quot; would work while a pending task was executing (file system).&lt;/p&gt;&lt;p&gt;File System&lt;/p&gt;&lt;p&gt;One goal that I had in mind was I wanted to support the file system functionality in such a way that it was not &amp;quot;local storage&amp;quot;.&amp;nbsp; I&amp;#39;d like to make it so that people can share content among one another, so it was necessary to create a file system that would work over the wire.&amp;nbsp; All of the &amp;quot;IDE&amp;quot; functionality is fully supported.&amp;nbsp; Eventually this layer will have to handle random access file functionality necessary to implement various file I/O keywords (which are not completed as yet).&lt;/p&gt;&lt;p&gt;Sound&lt;/p&gt;&lt;p&gt;The 5th keyword in the GW-BASIC manual is BEEP.&amp;nbsp; Since BEEP is an 800 Hz for 1/4th of a second tone, it made sense to tackle two keywords at once since SOUND 800, 4.55 produces the same result.&amp;nbsp; A&amp;nbsp;fortune would have it, Silverlight 3+ has the ability for me to fiddle with the PCM stream.&amp;nbsp; It does have it&amp;#39;s problems and, apparently, Silverlight 5 might be able to provide some solutions to the &amp;quot;lag&amp;quot; that I&amp;#39;m experiencing.&amp;nbsp; I have not tried this code yet on WP7; however, what is coming to Silverlight 5 is already supported on the phone implementation of Silverlight.&lt;/p&gt;&lt;p&gt;Keywords&lt;/p&gt;&lt;p&gt;As of this writing, 114 keywords have been implemented.&amp;nbsp; This is not to say they are 100% completed, but they are implemented enought to start testing and tweaking.&amp;nbsp; Additionally, definable functions, arrays, nested for loops, etc. are all working.&amp;nbsp; I&amp;#39;ve also implemented a few useful keywords that are not part of GW-BASIC which include OLD, LBOUND, UBOUND, LCASE$, and UCASE$.&amp;nbsp; LBOUND and UBOUND have been very helpful in working with getting arrays working.&lt;/p&gt;&lt;p&gt;Compatibility&lt;/p&gt;&lt;p&gt;As you can see, a lot of work for three weeks of spare time.&amp;nbsp; To put things into perspective, I think I have all keywords implemented based on documentation for the Dartmouth Oct&amp;#39;64 version as well as all of the listed keywords necessary for both BASIC Computer Games - Microcomputer Edition books (c. 1979) which is based on Microsoft Basic, Revision&amp;nbsp;4.0.&amp;nbsp; I have not done any testing of the programs included as a lot of them are kind of long.&amp;nbsp; However, I&amp;#39;ve also been&amp;nbsp;working my way&amp;nbsp;through&amp;nbsp;&amp;quot;A Bit of IBM BASIC&amp;quot; and all code samples up to page 90 are working.&amp;nbsp; There&amp;#39;s still a potential for a lot of bugs, so testing...testing...testing...&lt;/p&gt;&lt;p&gt;Summary&lt;/p&gt;&lt;p&gt;So far this has been an awesome side project and there is still a ton of things to complete.&amp;nbsp; I&amp;#39;m having a lot of opportunity to experience several technologies that I have not been able to play with in my &amp;quot;day job&amp;quot;; so this alone is worth the time and energy going into this project.&amp;nbsp; Who knows where it will end up; however, I have to remind myself to not focus on the destination, otherwise I&amp;#39;ll miss out on the splendor that is the journey.&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746781" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/BASIC/default.aspx">BASIC</category></item><item><title>VB10 vs VB6: Variants are not supported.</title><link>http://addressof.com/blog/archive/2011/07/27/VB10-vs-VB6_3A00_-Variants-are-not-supported_2E00_.aspx</link><pubDate>Wed, 27 Jul 2011 16:31:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746773</guid><dc:creator>CorySmith</dc:creator><slash:comments>1</slash:comments><comments>http://addressof.com/blog/comments/746773.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746773</wfw:commentRss><description>&lt;p&gt;This is part of series of posts categorized under &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx"&gt;&lt;font color="#000000"&gt;VB10 vs VB6&lt;/font&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;em&gt;&amp;quot;Variants are &lt;strong&gt;not&lt;/strong&gt; supported. Object is now the default data type.&amp;quot;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Wow!&amp;nbsp; Really?!?!?&amp;nbsp; Someone actually &amp;quot;defending&amp;quot; (or rather complaining) that Variants are not supported?&amp;nbsp; In any case...&lt;/p&gt;&lt;p&gt;Based on the wording of the entry, it is completely false to say &amp;quot;Variants are not supported.&amp;quot;.&amp;nbsp; They are completely supported.&amp;nbsp; However, it is also&amp;nbsp;true that Object is now the default data type.&amp;nbsp; I know that seems a little confusing; so let me explain.&amp;nbsp; &lt;/p&gt;&lt;p&gt;In VB6, the default &amp;quot;unknown&amp;quot; type was a Variant.&amp;nbsp; In VB10, the base type (since VB10 is a true object oriented language) is Object; of which all types derive.&amp;nbsp; It is also important to understand that Variant is *not* a native data type in VB10.&amp;nbsp; &lt;/p&gt;&lt;p&gt;So how, you may ask, does VB10 have support for Variant if there isn&amp;#39;t a data type of Variant?&amp;nbsp; Think about it for a moment.&amp;nbsp; Where is Variant needed?&amp;nbsp; VB4 (32-bit) through VB6 is a COM (aka ActiveX / OLE Automation) based product.&amp;nbsp; Because of this, Variant made sense since this is a &amp;quot;native&amp;quot; type of the COM world.&amp;nbsp; .NET has its own type system; of which Variant is not a &amp;quot;native&amp;quot; type.&amp;nbsp; However, .NET is great about interoperating&amp;nbsp;with other technologies which includes COM.&amp;nbsp; Because of this, there is full support for the Variant data type when working with COM interfaces.&lt;/p&gt;&lt;p&gt;Verdict:&lt;/p&gt;&lt;p&gt;VB10 does have support for Variants; so you be the judge.&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746773" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category></item><item><title>VB10 vs VB6: Option Base</title><link>http://addressof.com/blog/archive/2011/06/29/VB10-vs-VB6_3A00_-Option-Base.aspx</link><pubDate>Wed, 29 Jun 2011 12:55:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746761</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746761.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746761</wfw:commentRss><description>&lt;p&gt;This is part of series of posts categorized under &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx"&gt;&lt;font color="#000000"&gt;VB10 vs VB6&lt;/font&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;em&gt;&amp;quot;Option Base is &lt;strong&gt;not&lt;/strong&gt; supported.&amp;quot;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;OK, time for a little history (extremely shortened).&amp;nbsp; In the beginning, BASIC had 1 based arrays (May 1964).&amp;nbsp; The creators of BASIC realized that this had certain limitations to it so about five months later when version 2 of the language was released (October 1964), the arrays changed from being 1 based to 0 based.&amp;nbsp; Fast forward nearly 14 years (1978) and the language was going through the process of becoming a &amp;quot;standard&amp;quot; and the committee related to doing so fought among themselves until a compromise was made&amp;nbsp;by&amp;nbsp;creating OPTION BASE n so that the users of the language could decide for themselves what the base array number would be.&amp;nbsp; However, 0 was chosen as the default.&amp;nbsp; But wait, it gets more interesting when you fast forward another 6 years (1984) to yet another &amp;quot;standard&amp;quot; and they&amp;#39;ve changed the default from a 0 to a 1.&lt;/p&gt;&lt;p&gt;So you can see this issue has existed LONG before VB and will probably continue for a very long time.&amp;nbsp; There are definately cases to support both arguments; however, one thing that is interesting to note is the following statement:&lt;/p&gt;&lt;p&gt;&amp;quot;But there was still a major problem for beginners.&amp;nbsp; They shouldn&amp;#39;t have to learn about the OPTION BASE statement, but they would be surprised when they used &amp;#39;DIM X(10)&amp;#39; and got a list with eleven elements in it.&amp;quot; -- Kemeny/Kurtz @ 1984.&lt;/p&gt;&lt;p&gt;So where does this leave us.&amp;nbsp; First I have to state that this statement is, in fact, correct.&amp;nbsp; OPTION BASE does not exist in VB10.&amp;nbsp; However, I can somewhat see that since one of the major goals of .NET/CLS/CLR is to allow multiple languages to interoperate seemlessly with one another.&amp;nbsp; An array in each of the supported languages works the same across all supported languages.&amp;nbsp; OPTION BASE would require the VB compiler to have to do all sorts of translations, which I suspect would not be too much work to accomplish.&amp;nbsp; However, if someone documented a method in VB using OPTION BASE 1 and someone in C#, F#, Ruby, Python, etc. were to try to utilize the result; they&amp;#39;d be left in bit of a quandry as to why array(0) exists.&lt;/p&gt;&lt;p&gt;However, let&amp;#39;s say for argument sake that cross language isn&amp;#39;t something a particular developer ever has to face.&amp;nbsp; Let&amp;#39;s say that this developer is going to only &amp;quot;consume&amp;quot; the produce and never produce anything that will be reused by anyone else.&amp;nbsp; So in this case, it might be nice to have the ability to define the base of an array to be 0 or 1 depending on their specific needs.&amp;nbsp; The problem that I&amp;#39;ve found is that circumstances seem to be so varied regarding when 0 or 1 seems to be the more natural choice that, at least to me, I find it simpler to keep the foundation at one level so that I know where I stand.&amp;nbsp; Meaning, I know that an array always starts at 0 so all my code can be built as such.&lt;/p&gt;&lt;p&gt;I do also have to say I understand, and even agree, that it&amp;#39;d be nice to have the ability to create an array that has a more natural feel to it depending on the circumstances at hand.&amp;nbsp; So....&lt;/p&gt;&lt;p&gt;At the end of the day, OPTION BASE probably isn&amp;#39;t needed.&amp;nbsp; The ability to define an array with a &amp;quot;custom&amp;quot; lower bound, on an array by array basis is what I would say would be a much more appropriate solution.&amp;nbsp; VB10 has plenty of ways to accomplish this, of which&amp;nbsp;I&amp;#39;ve already &lt;a href="http://addressof.com/blog/archive/2011/06/04/VB10-vs-VB6_3A00_-Array-Lower-Bounds.aspx"&gt;covered&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Verdict:&lt;/p&gt;&lt;p&gt;This discussion has been going on for 47 years now... so who am I to sway it one way or the other.&amp;nbsp; With that said, technically VB10 does not have OPTION BASE, so it seems I have to give this one to VB6.&amp;nbsp; However, as covered in the lower bound array post, VB10 has an incredible amount of flexibility in creating &amp;quot;arrays&amp;quot; / classes to better handle the specific needs with regards to a collection of information.&amp;nbsp; So I leave this one as an excercise to the reader to draw&amp;nbsp;thier own conclusion.&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746761" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category></item><item><title>BASIC - Status as of 2011-06-27.</title><link>http://addressof.com/blog/archive/2011/06/27/BASIC-_2D00_-Status-as-of-2011_2D00_0_2D00_6_2D00_27_2E00_.aspx</link><pubDate>Mon, 27 Jun 2011 15:53:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746760</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746760.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746760</wfw:commentRss><description>&lt;p&gt;I still don&amp;#39;t have a name for the BASIC project I&amp;#39;m working on; however, would like to share some of the progress I&amp;#39;ve made.&lt;/p&gt;&lt;p&gt;Parser (technically a scanner/ validating parser) layer is far enough along that I think it will be pretty simple to continue to add additional keywords to it without any major redesigns involved.&amp;nbsp; This has taken the most amount of the overall projects time; as I&amp;#39;d hope everyone would suspect.&amp;nbsp; It&amp;#39;s got to be right and it&amp;#39;s got to be fast.&lt;/p&gt;&lt;p&gt;Switched the project from Windows Forms to Silverlight and had to fix the 100+ errors introduced because of the limited nature of the Silverlight CLR.&amp;nbsp; Built a test harness that would allow interactive testing of the Parser.&amp;nbsp; This provided me a little bit of room to experiment with syntax highlighting using the&amp;nbsp;Silverlight RichTextBox control as a proof of&amp;nbsp;concept.&amp;nbsp; Once I got this working, on to the next phase.&lt;/p&gt;&lt;p&gt;Built a Display&amp;nbsp;object that would allow me to seperate the implementation of the display away from the actual implementation afforded by the platform.&amp;nbsp; The goal is to reproduce the experience of DOS within Silverlight with the possibility of doing the same through Windows Forms, &amp;quot;Windows8&amp;quot;, WPF, XNA or whatever else may come along.&amp;nbsp; To do this, I&amp;#39;m doing a per-pixel implementation rather than leverage the ability to render Silverlight specific objects.&amp;nbsp; Yes, this even means that I&amp;#39;m drawing my own fonts. ;-)&lt;/p&gt;&lt;p&gt;Once the initial Display object was done, moved on to creating an &amp;quot;IDE&amp;quot;.&amp;nbsp; Initially, for nostalgia sake, I&amp;#39;m working on recreating the GW-BASIC experience.&amp;nbsp; Where I go from there is left to a future decision.&amp;nbsp; Pretty much got that working, now on to the Command Parser.&lt;/p&gt;&lt;p&gt;The Command&amp;nbsp;Interpreter (which leverages the Parser) is still in it&amp;#39;s infancy; however, commands like LIST, KEY, NEW, etc. are working as well as the &amp;quot;editing&amp;quot; functions associated with the source list.&lt;/p&gt;&lt;p&gt;So all in all, not bad progress; however, this is the point where I think things will begin to slow a bit since it&amp;#39;s all about implementing the various keywords as well as beginning work on the actual interpreter.&amp;nbsp; I&amp;#39;ve already build a rough interpreter in the Windows Forms implementation; however, this time I&amp;#39;m putting a little more thought into it.&lt;/p&gt;&lt;p&gt;The key thing I&amp;#39;m keeping in mind going forward is trying to keep separations of concern in mind as I design things.&amp;nbsp; I caught myself wanting to add validation logic in the scanner/parser for a range of a parameter... which should be done at the compiler/interpreter level since the purpose of the scanner/parser is to just &amp;quot;parse&amp;quot; the text into a token tree.&amp;nbsp; It&amp;#39;s up to &amp;quot;something else&amp;quot; to verify that the parameters are correct.&amp;nbsp; (Some could probably argue this, however, at this time, this is the way that I&amp;#39;m designing it.&amp;nbsp; We&amp;#39;ll have to see if I change going forward or not.)&lt;/p&gt;&lt;p&gt;Thanks for following along, see you in the next update.&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746760" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/BASIC/default.aspx">BASIC</category></item><item><title>Back to BASIC!</title><link>http://addressof.com/blog/archive/2011/06/20/Back-to-BASIC_2100_.aspx</link><pubDate>Mon, 20 Jun 2011 15:03:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746759</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746759.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746759</wfw:commentRss><description>&lt;p&gt;Before I make an announcment, I have to make it ubundantly clear that&amp;nbsp;I&amp;#39;m a huge fan of&amp;nbsp;Microsoft Visual Basic and do not have any significant complaints on where Microsoft has travelled with the language and, without risk of violatinig NDA, where Microsoft is planning on going.&amp;nbsp; I also have to state that I do own stock in Microsoft (as it turns out, it&amp;#39;s the only company at this time that I do own stock with); so kind of provides an idea of the faith that I have in the team at Microsoft working on the language and tools that make up Microsoft Visual Basic.&lt;/p&gt;&lt;p&gt;With that said, I&amp;#39;ve been interested in some time about how compilers work and what is involved in building them.&amp;nbsp; I also have been, again for some time, very sad that BASIC is no longer shipping with the OS.&amp;nbsp; It just seems like something has been missing.&amp;nbsp; I&amp;#39;ve also had several people approach me recently proclaiming &amp;quot;I want to learn how to write software.&amp;quot;&amp;nbsp; It got me to thinking, &amp;quot;where do they start?&amp;quot;.&amp;nbsp;&amp;nbsp;So my initial reaction was to think about what was already available on every persons computer.&amp;nbsp; The web browser!&amp;nbsp; So without meaning to insult those that make a living building HTML, I don&amp;#39;t really consider that a &amp;quot;programming language&amp;quot;; to me, it&amp;#39;s a document and I do have to tip my hat to those that can build beautiful pages working with HTML/CSS.&amp;nbsp; However, there is this thing called JavaScript (or JScript if you prefer).&amp;nbsp; The problem is that in order to write an &amp;quot;application&amp;quot;, you will have to learn at least a little bit of HTML (concepts and tags), possibly some CSS (could skip, but hey, you&amp;#39;ll know it&amp;#39;ll be there eventually), the JavaScript language and all that entails as well as possibly having to learn something about the DOM.&amp;nbsp; Wow!&amp;nbsp; What ever happened to just being able to...&lt;/p&gt;&lt;p&gt;10 PRINT &amp;quot;HELLO WORLD!&amp;quot;&lt;/p&gt;&lt;p&gt;... execute it and it provided immediate feedback?&amp;nbsp; Because of it&amp;#39;s simplicity, you could experiment and &amp;quot;play&amp;quot;.&amp;nbsp; What ever happened to &amp;quot;playing&amp;quot;?&amp;nbsp; I remember a time with writing code was ***fun***.&amp;nbsp; Now it seems to be a world of &amp;quot;if you don&amp;#39;t write it this way, it&amp;#39;s crap&amp;quot; and you have to learn several technologies, concepts, programming best practices, etc. before you can even begin to get the computer to bend to your will.&amp;nbsp; &lt;/p&gt;&lt;p&gt;So it got me to thinking.&amp;nbsp; At this point, it was just thinking...&lt;/p&gt;&lt;p&gt;Then I remembered the Microsoft Research project called SmallBasic.&amp;nbsp; Interesting concept.&amp;nbsp; Disappointed in a couple of respects; one in particular is the usage of square brackets as indexers on arrays.&amp;nbsp; I wouldn&amp;#39;t have a huge problem with this if it wasn&amp;#39;t for the fact that the environment has a pretty large button called &amp;quot;Graduate&amp;quot; that is supposed to convert the &amp;quot;project&amp;quot; to a Microsoft Visual Basic project; which, of course, VB does not use square brackets for array indexers.&amp;nbsp; So for the inconsistency and the fact that it also will not translate TextWindow.WriteLine(&amp;quot;Hello World&amp;quot;) to Console.WriteLine(&amp;quot;Hello World&amp;quot;), I have to express a little bit of a level of disappointment.&amp;nbsp; I will say, regarding SmallBasic, I do like some of the intellisense-esque stuff they are doing.  It is pretty simple to get started and, again, I love the concept.   I suspect that it was built by someone that was not from a BASIC background, and for that, I might be a bit critical.&lt;/p&gt;&lt;p&gt;Additionally, I have David Ahl&amp;#39;s book circa 1978 called Basic Computer Games.&amp;nbsp; It appears that he updated the material for SmallBasic and has a sample chapter on his site that I could use to compare the new with the old.&amp;nbsp; The new game in the sample chapter is something like 790 lines of code while the original is something like 45.&amp;nbsp; Huh?&amp;nbsp; OK, after digging a little deaper, it appears that the code is not a literal translation and contains a few bonuses; but still... 45 lines to 790 lines?&amp;nbsp; &lt;/p&gt;&lt;p&gt;So, again, it got me to thinking.&lt;/p&gt;&lt;p&gt;What would it take to return back to my roots so to speak and have a very simple version of BASIC on top of the .NET Framework?&amp;nbsp; Would there be any value in doing so?&amp;nbsp; After a bit of research, experimentation and thought, I&amp;#39;ve decided that at least ***I*** would find this valuable if for nothing more than the learning experience that it would have.&amp;nbsp; So with that said, I&amp;#39;m officially working on BASIC for .NET.&amp;nbsp; There&amp;#39;s not a whole lot of &amp;quot;Visual&amp;quot; and I am starting with the original Dartmouth&amp;nbsp;documentation (circa October 1, 1964) as the &amp;quot;language spec&amp;quot;.&amp;nbsp; Once I have this&amp;nbsp;milestone done, who knows where I&amp;#39;ll take it next.&amp;nbsp; &lt;em&gt;Actually, for full disclosure, I already have a few ideas. ;-)&lt;/em&gt;&lt;/p&gt;&lt;p&gt;As a side note, all&amp;nbsp;I can say is WOW!&amp;nbsp; It&amp;#39;s amazing to see where BASIC started and where it is today.&amp;nbsp; Just think, it&amp;#39;s only a little over 3 years away from being&amp;nbsp;a half a&amp;nbsp;century&amp;nbsp;of history.&amp;nbsp; BASIC has also kept the name intact throughout all of these years.&amp;nbsp; Contrast that with CPL, Basic CPL, B, C, C++, etc.&amp;nbsp; (No, BASIC isn&amp;#39;t the oldest, longest running language, I think FORTRAN holds that title... and yes, there is a version of it for .NET (Fortran 95 spec I think.), but it does predate C by almost a decade.)&lt;/p&gt;&lt;p&gt;So one day soon, you&amp;#39;ll be able to build a source file with a .BAS extension, pipe it through a compiler and run an executable (.NET assembly) that consists of:&lt;/p&gt;&lt;p&gt;10 PRINT &amp;quot;HELLO WORD!&amp;quot;&lt;br /&gt;20 GOTO 10&lt;/p&gt;&lt;p&gt;I&amp;#39;ll also be discussing topics related to this project as things progress.&lt;/p&gt;&lt;p&gt;I will have to leave this with a note.&amp;nbsp; Some may wonder why I would choose to use BASIC as a basis for the language when building a compiler... the answer is... &amp;quot;Because.&amp;quot; and leave it at that. It&amp;#39;s my compiler and I can do it however I want. ;-)&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746759" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/BASIC/default.aspx">BASIC</category></item><item><title>VB10 vs VB6: Dynamic Arrays Usage In Structures</title><link>http://addressof.com/blog/archive/2011/06/20/VB10-vs-VB6_3A00_-Dynamic-Arrays-Usage-In-Structures.aspx</link><pubDate>Mon, 20 Jun 2011 14:42:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746751</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746751.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746751</wfw:commentRss><description>&lt;p&gt;This is part of series of posts categorized under &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx"&gt;VB10 vs VB6&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;em&gt;&amp;quot;Dynamic arrays are not allowed within structures (UDTs) &amp;quot;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;I&amp;#39;m kind of scratching my head by this statement as I&amp;#39;m not entirely sure what he means by&amp;nbsp;&amp;quot;dynamic arrays&amp;quot;.&amp;nbsp; I will assume that he means:&lt;/p&gt;&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;Structure&lt;/font&gt;&amp;nbsp;&lt;font color="#2b91af"&gt;SomeType&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;Public&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;SomeArray() &lt;/font&gt;&lt;span style="color:blue;"&gt;As&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color:blue;"&gt;Integer&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;End Structure&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The above is an array of integers that has no defined indexer.&amp;nbsp; Additionally, the above code does not present any sort of error within Visual Studio.&lt;/p&gt;&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;Dim&lt;/font&gt;&amp;nbsp;s &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;/font&gt;&lt;span style="color:blue;"&gt;&lt;font color="#2b91af" face="Consolas"&gt;SomeType&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt; &lt;br /&gt;Redim&amp;nbsp;&lt;font color="#000000"&gt;s(20)&lt;/font&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Again, the above code appears to be syntactically correct within Visual Studio.&amp;nbsp; So we created a structure, defined an array and redimensioned the array.&amp;nbsp; &lt;/p&gt;&lt;p&gt;However, with the advent of Generics and the flexibility that they bring to the table, I&amp;#39;d modify the structure so that it utilizes a Generic List as follows:&lt;/p&gt;&lt;p&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; Public&lt;/span&gt;&lt;font color="#000000"&gt; SomeArray() &lt;/font&gt;&lt;span style="color:blue;"&gt;As&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;List&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;span style="color:blue;"&gt;Of Integer&lt;font color="#000000" size="2"&gt;)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;You would, however, have to initialize the array as it would begin &amp;quot;life&amp;quot; as Nothing.&amp;nbsp; To do this:&lt;/p&gt;&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;Dim&lt;/font&gt; s &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;/font&gt;&lt;span style="color:blue;"&gt;&lt;font color="#2b91af" face="Consolas"&gt;SomeType&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt; &lt;br /&gt;&lt;font color="#000000"&gt;s.SomeArray = &lt;font color="#0000ff"&gt;New &lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#2b91af"&gt;List&lt;/font&gt;&lt;font color="#000000"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;span style="color:blue;"&gt;Of Integer&lt;font color="#000000" size="2"&gt;)&lt;/font&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Arial" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;From here, you could use the Add, Insert, Remove, etc. available on the Generic List to truly provide a &amp;quot;dynamic array&amp;quot; that is far above and beyond what was&amp;nbsp;available&amp;nbsp;with VB6 &amp;quot;native&amp;quot; arrays.&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Verdict: &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;So unless I&amp;#39;m misinterpreting the statement, VB does fully support &amp;quot;dynamic arrays&amp;quot; in user defined types (Structures).&amp;nbsp; With that said, I have to hand this one to VB10.&lt;br /&gt;&lt;br /&gt;Update(s):&lt;br /&gt;&lt;br /&gt;Well, technically not an update as it was in an email I got before I finished writing this entry, &lt;a href="http://msmvps.com/blogs/bill/Default.aspx"&gt;Bill McCarthy&lt;/a&gt; (MVP) points out that this &amp;quot;issue&amp;quot; may be related to usage of dynamic arrays in stuctures with regards to Win32 API and the &amp;quot;default marshalling&amp;quot; done.&amp;nbsp; This is a very good point and one that can be anwered by pointing to the previous entry where I point out that the .NET interop story is much better than the VB6 counterpart.&amp;nbsp; With that said, I&amp;#39;d like to point you to the complete list of ways that the .NET interop mechanism can do using the MarshalAs attribute.&amp;nbsp; See &lt;a href="http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.unmanagedtype.aspx"&gt;MSDN Unmanaged Type Enum&lt;/a&gt;.&amp;nbsp; As you can see, you have a plethora of choices specifically regarding arrays.&amp;nbsp; Thanks Bill for bringing this to my attention.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746751" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category></item><item><title>VB10 vs VB6: Array Lower Bounds</title><link>http://addressof.com/blog/archive/2011/06/04/VB10-vs-VB6_3A00_-Array-Lower-Bounds.aspx</link><pubDate>Sat, 04 Jun 2011 14:36:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746744</guid><dc:creator>CorySmith</dc:creator><slash:comments>2</slash:comments><comments>http://addressof.com/blog/comments/746744.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746744</wfw:commentRss><description>&lt;p&gt;This is part of series of posts categorized under &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx"&gt;VB10 vs VB6&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;Arrays may &lt;strong&gt;not&lt;/strong&gt; have a lower bound other than zero.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;
This, as it turns out, is absolutely true; however, with a twist.&amp;nbsp; Although VB10 does not allow the &amp;quot;native&amp;quot; array type (the one defined by the language), there are a ton of ways that this can be handled.&amp;nbsp; I would also argue that the multitude of ways that are available would also provide a solution that better suites the needs for circumstances where having a different lower bound is desired.&lt;/p&gt;&lt;p&gt;Let&amp;#39;s see how you could accomplish&amp;nbsp;similar functionality&amp;nbsp;without delving into the .NET Framework.&amp;nbsp; The most direct solution is to handle the lower bound yourself by determining the offset from 0 and access the array accordingly.&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;Dim&lt;/span&gt; lbound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;font color="#000000"&gt; =&amp;nbsp;10&lt;font face="Arial" size="2"&gt;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;Dim&lt;/span&gt;&lt;font color="#000000"&gt; ubound &lt;/font&gt;&lt;span style="color:blue;"&gt;As&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color:blue;"&gt;Integer&lt;font color="#000000"&gt; = 20&lt;font face="Arial" size="2"&gt;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;Dim&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;a&lt;font face="Arial" size="2"&gt;(ubound - lbound)&lt;/font&gt; &lt;/font&gt;&lt;span style="color:blue;"&gt;As&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="color:blue;"&gt;Integer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;a(10 - lbound) =&amp;nbsp;value&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;So you could easily handle&amp;nbsp;this by utilizing some simple&amp;nbsp;math.&amp;nbsp; Let&amp;#39;s say, however, that you&amp;#39;d like to have&amp;nbsp;it programatically similar to VB6.&amp;nbsp; You could create a&amp;nbsp;class that&amp;nbsp;abstracts this math and provides a very similar experience to VB6.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt;&lt;font color="#000000"&gt; a &lt;span style="color:blue;"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&lt;span style="color:blue;"&gt;As New&lt;/span&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;span style="color:#2b91af;"&gt;VbIntegerArray&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Arial" size="2"&gt;(lbound,&amp;nbsp;ubound)&lt;br /&gt;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;a(10) = value&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;The code for the VbIntegerArray is as follows:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;span style="color:blue;font-family:Consolas;font-size:9.5pt;"&gt;Public&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt; &lt;span style="color:blue;"&gt;Class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;VbIntegerArray&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Private&lt;/span&gt; m_lbound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Private&lt;/span&gt; m_int() &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; &lt;span style="color:blue;"&gt;New&lt;/span&gt;(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; lowerBound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; upperBound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Me&lt;/span&gt;.ReDim(lowerBound, upperBound)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; [ReDim](&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; lowerBound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt;
upperBound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;m_lbound
= lowerBound&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;ReDim&lt;/span&gt; m_int(upperBound - lowerBound + 1)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Default&lt;/span&gt; &lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Property&lt;/span&gt; Item(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt;
index &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;)
&lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Get&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Return&lt;/span&gt; m_int(index - m_lbound)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Get&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Set&lt;/span&gt;(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; Value &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;m_int(index - m_lbound) = Value&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Set&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Property&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;font-family:Consolas;font-size:9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt; &lt;span style="color:blue;"&gt;Class&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Not too difficult.&amp;nbsp; Note, this code is based off of a &lt;a href="http://blogs.msdn.com/b/vbfaq/archive/2004/04/20/116660.aspx"&gt;blog entry&lt;/a&gt; by &lt;a href="http://www.philweber.com/"&gt;Phil Weber&lt;/a&gt;.&amp;nbsp;&amp;nbsp;I made a few minor changes to, so feel free to use this or his depending on your needs.&amp;nbsp; Using this method requires that you create a seperate class for each variable type you want to have an &amp;quot;array&amp;quot; with a different lower bounds than 0.&amp;nbsp; Another approach, as mentioned toward the end of Phil&amp;#39;s blog entry is the possibility of using Generics.&amp;nbsp; I&amp;#39;ve re-wired the above class to create a generic version.&amp;nbsp; The internal implementation is not a &amp;#39;native&amp;#39; language array, but instead is leveraging the Generic List object.&amp;nbsp; Because of this, I am having to prepopulate the &amp;quot;array&amp;quot; with items so that the indexer works as expected.&amp;nbsp; Furthermore, because it is a generic type, I&amp;#39;m populating each entry with Nothing (NULL).&amp;nbsp; Outside of that, everything is basically similar to the direct implementation.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="color:blue;font-family:Consolas;font-size:9.5pt;"&gt;Public&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt; &lt;span style="color:blue;"&gt;Class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;VbArrayGeneric&lt;/span&gt;(&lt;span style="color:blue;"&gt;Of&lt;/span&gt;
T)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Private&lt;/span&gt; m_lbound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Private&lt;/span&gt; m_array &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;List&lt;/span&gt;(&lt;span style="color:blue;"&gt;Of&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;T&lt;/span&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; &lt;span style="color:blue;"&gt;New&lt;/span&gt;(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; lowerBound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; upperBound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Me&lt;/span&gt;.ReDim(lowerBound, upperBound)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; [ReDim](&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; lowerBound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;, &lt;span style="color:blue;"&gt;ByVal&lt;/span&gt;
upperBound &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;m_lbound
= lowerBound&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;m_array.Clear()&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;For&lt;/span&gt; index &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt; = 0 &lt;span style="color:blue;"&gt;To&lt;/span&gt;
upperBound - lowerBound&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;m_array.Add(&lt;span style="color:blue;"&gt;Nothing&lt;/span&gt;)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Next&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Default&lt;/span&gt; &lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Property&lt;/span&gt; Item(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt;
index &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;)
&lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;T&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Get&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Return&lt;/span&gt; m_array(index - m_lbound)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Get&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;Set&lt;/span&gt;(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; Value &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;T&lt;/span&gt;)&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;m_array(index - m_lbound) = Value&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Set&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Property&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="color:blue;font-family:Consolas;font-size:9.5pt;"&gt;End&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt; &lt;span style="color:blue;"&gt;Class&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;To utilize the above code, you can do the following: &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;/font&gt;&lt;p&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;Dim&lt;/span&gt; a &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;New&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;VbArrayGeneric&lt;/span&gt;(&lt;span style="color:blue;"&gt;Of&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt;)(10, 20)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;For&lt;/span&gt; index &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt; = 10 &lt;span style="color:blue;"&gt;To&lt;/span&gt; 20&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp;
&lt;/span&gt;a(index) = index&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;/font&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;For&lt;/span&gt; index &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;Integer&lt;/span&gt; = 10 &lt;span style="color:blue;"&gt;To&lt;/span&gt; 20&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(a(index))&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;
&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;In addition to the ways described, the Generic version of the Dictionary class might also be leveraged to provide similar capabilities.&amp;nbsp; By using a dictionary, you would no longer be bound (no pun intended) to a lower and upper bound since each entry has a unique key and can be of any value. If interested in seeing this approach, please let me know.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Verdict:&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;This one&amp;#39;s hard to provide a clear verdict.&amp;nbsp;&amp;nbsp;On the&amp;nbsp;one hand, it&amp;#39;s clear that the &amp;#39;native&amp;#39;&amp;nbsp;language array&amp;nbsp;does not support&amp;nbsp;arrays with a lower bound other than 0.&amp;nbsp; On the other, there are a plethora of ways to implement &amp;quot;arrays&amp;quot; available in VB10.&amp;nbsp; Because of this, I&amp;#39;m going to call this one a wash.&amp;nbsp; (Note: I may come back and give this one to VB6 depending on how the rest of the list goes; only because of the way that the entry was stated, VB10 does not do exactly what it states.)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Update(s)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;&lt;a href="http://msmvps.com/blogs/bill/Default.aspx"&gt;Bill McCarthy&lt;/a&gt; (MVP) writes in : &amp;quot;I&amp;#39;d add IEnumerable/IEnumerable(Of T) support to the classes passing it straight through to the array&amp;#39;s GetEnumerator.&amp;nbsp; And this is actually where it gets interesting. If I recall correctly For Each with arrays in .NET is optimised; you&amp;#39;d probably lose a little bit with the custom class, but as long as it was IEnumerable(Of T) as opposed to the non-generic version there shouldn&amp;#39;t be any boxing overhead. That said, I seem to recall (but don&amp;#39;t quote me on this as it is a LONG time ago), that VB6 had perf problems with For Each (pCode versus native may have changed the outcome too), as I think it went all variant gooey stuff ;) Anyway, real world implementation in .NET, include IEnumerable(Of T)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746744" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category></item><item><title>VB10 vs VB6: Private Class Variables </title><link>http://addressof.com/blog/archive/2011/06/04/VB10-vs-VB6_3A00_-Private-Class-Variables-.aspx</link><pubDate>Sat, 04 Jun 2011 14:02:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746739</guid><dc:creator>CorySmith</dc:creator><slash:comments>1</slash:comments><comments>http://addressof.com/blog/comments/746739.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746739</wfw:commentRss><description>&lt;p&gt;This is part of series of posts categorized under &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx"&gt;VB10 vs VB6&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&amp;quot;Private class variables are &lt;strong&gt;not&lt;/strong&gt; private to the class instance.&amp;quot; &lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is another one of those &amp;quot;huh?&amp;quot; responses.&amp;nbsp; However, I&amp;#39;ll go ahead and discuss it anyway.&lt;/p&gt;

&lt;p&gt;As documented in the VB6 Programmers Guide on page 429, &lt;/p&gt;

&lt;p&gt;&lt;em&gt;&amp;quot;It&amp;#39;s just as easy to create private data for a class; simply declare a variable Private, and it will be accessible only from code within the class module.&amp;quot;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;font face="Consolas" size="2"&gt;&lt;font color="#0000ff"&gt;Private&lt;/font&gt; mstrMothersMaidenName &lt;font color="#0000ff"&gt;As String&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;This is what I can only assume Karl is referring to with the statement that private class variables are not private to the class instance.&amp;nbsp; Based on this, let&amp;#39;s look at VB10:&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas" size="2"&gt;&lt;font color="#0000ff"&gt;Class&lt;/font&gt; &lt;font color="#2b91af"&gt;Class1&lt;/font&gt;&lt;br /&gt;

&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;Private&lt;/font&gt; m_mothersMaidenName &lt;font color="#0000ff"&gt;As String&lt;/font&gt;&lt;br /&gt;

&lt;font color="#0000ff"&gt;End Class&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Consolas" size="2"&gt;

&lt;font color="#0000ff"&gt;Class&lt;/font&gt; &lt;font color="#2b91af"&gt;Class2&lt;/font&gt;&lt;br /&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;Sub&lt;/font&gt; DoSomething()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font color="#0000ff"&gt;Dim&lt;/font&gt; c &lt;font color="#0000ff"&gt;As New Class1&lt;/font&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; c.m_mothersMaidenName = &amp;quot;&amp;quot;&lt;br /&gt;
&amp;nbsp; &lt;font color="#0000ff"&gt;End Sub&lt;/font&gt;&lt;br /&gt;
&lt;font color="#0000ff"&gt;End Class&lt;/font&gt;&lt;/font&gt;

&lt;/p&gt;&lt;p&gt;I have to point out that this code will immediately draw your attention to it by draing a blue wavy line below it and in the Error List you&amp;#39;ll see something similar to the following:&lt;/p&gt;&lt;p&gt;&lt;em&gt;&amp;#39;Class1.m_mothersMaidenName&amp;#39; is not accessible in this context because it is &amp;#39;Private&amp;#39;.&amp;nbsp;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;At this point, you&amp;nbsp;are not able compile the code until error has to be addressed.&amp;nbsp; Sure looks like the private variable is private to the class to me.&lt;/p&gt;&lt;p&gt;Verdict:&lt;/p&gt;&lt;p&gt;Not much to say, this one just isn&amp;#39;t true.  It was never true to the best of my knowledge so the nod, again, has to go to VB10.&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Update(s):&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;&lt;a href="http://msmvps.com/blogs/bill/Default.aspx"&gt;Bill McCarthy&lt;/a&gt; (MVP) writes in : &amp;quot;I think this is referring to accessing private variables from *another* instance of the same class. Reason for its existence in .NET is two-fold: &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;first the addition of shared methods to a class: this is probably the heart of the technical reason why.&amp;nbsp;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;li&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;it also comes in handy a LOT for operator overloading (equality operators), serialization etc.&amp;quot;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;font color="#000000" face="Arial" size="2"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Interesting.&amp;nbsp; I can almost see this as being a possible point of contention.  However, just because you can &amp;quot;see&amp;quot; it doesn&amp;#39;t mean you can &amp;quot;use&amp;quot; it.&amp;nbsp;&amp;nbsp;&amp;nbsp;Serialization almost deserves it&amp;#39;s own conversation; however, there are cases where you might need access to &amp;quot;member variables&amp;quot;.&amp;nbsp; In any case,&amp;nbsp;when they are set to private they are, in fact, scoped as such.&amp;nbsp; I may have to give this more thought.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746739" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category></item><item><title>VB10 vs VB6: ByVal/ByRef within API calls. </title><link>http://addressof.com/blog/archive/2011/06/02/VB10-vs-VB6_3A00_-ByVal_2F00_ByRef-within-API-calls.-.aspx</link><pubDate>Thu, 02 Jun 2011 14:54:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746735</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746735.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746735</wfw:commentRss><description>&lt;p&gt;This is part of series of posts categorized under &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx"&gt;VB10 vs VB6&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&amp;quot;Use of &lt;strong&gt;ByVal/ByRef&lt;/strong&gt; directly within API calls is &lt;strong&gt;not&lt;/strong&gt;  supported.&amp;quot;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Huh?&lt;/p&gt;

&lt;p&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Declare&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Function&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; SetEnvironmentVariable &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Lib&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&amp;quot;kernel32&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Alias&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&amp;quot;SetEnvironmentVariableA&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; ( _&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp; ByVal&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; lpName &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;String&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;,&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&amp;nbsp; ByVal&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; lpValue &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;String&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;) &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Boolean&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;The above code is syntactically correct in VB6 and VB10.&amp;nbsp;Notice the inclusion of the word ByVal.&amp;nbsp; You could use ByRef as well.&amp;nbsp; Additionally, VB10 offers a plethora of additional options that allow you to further define how things are passed to various api implementations.&amp;nbsp; So the above statement could be written as:&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Declare&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Auto&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Function&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; SetEnvironmentVariable &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Lib&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&amp;quot;kernel32&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Alias&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&amp;quot;SetEnvironmentVariableA&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; (&lt;br /&gt;
&amp;nbsp; &amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;MarshalAsAttribute&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;UnmanagedType&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;.LPStr)&amp;gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; lpName &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;String&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;,&lt;br /&gt;
&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;MarshalAsAttribute&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;UnmanagedType&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;.LPStr)&amp;gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; lpValue &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;String&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;) &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Boolean&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;This will cause the strings to be passed as a long pointer to a string instead of a BStr.&amp;nbsp; Additionally, the Auto keyword will cause the interop process to use ANSI or Unicode strings depending on the target API.&lt;/p&gt;&lt;p&gt;What I&amp;#39;m showing here just scratches the surface of what VB10 can do regarding interoperating with the Windows API&amp;#39;s.&amp;nbsp; In any case, the ByVal keyword is definately there, so I&amp;#39;m not sure what Karl is trying to say with this one.&lt;/p&gt;&lt;p&gt;Verdict:&lt;/p&gt;&lt;p&gt;The statement that ByVal and ByRef are not supported is obviously false so I have to give this one to VB10.&lt;/p&gt;&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;span style="font-family:Consolas;font-size:9.5pt;"&gt;&lt;span style="color:blue;"&gt;&lt;font color="#000000" face="Arial" size="2"&gt;Update(s):&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msmvps.com/blogs/bill/Default.aspx"&gt;Bill McCarthy&lt;/a&gt; (MVP) writes in: &amp;quot;Again my memory is getting rusty, but I think this refers to the use of As Any, then you could pass a variable out ByRef or ByVal.&amp;nbsp; Often the cause of many mistakes hard to track down as a variable address would be sent instead of the value etc.&amp;quot;&lt;br /&gt;&lt;br /&gt;Bill apparently agrees with me regarding &amp;quot;As Any&amp;quot; being a &amp;quot;bad thing&amp;quot;. ;-)&amp;nbsp; He does bring up a good point regarding ByRef/ByVal from the perspective of &amp;quot;how&amp;quot; interop works in .NET (thus VB10).&amp;nbsp;Win32 API signatures as defined in VB most likely will not be identical in behavior with the move to VB10.&amp;nbsp; With that said, using a site&amp;nbsp;such as&amp;nbsp;&lt;a href="http://pinvoke.net/"&gt;http://pinvoke.net/&lt;/a&gt;&amp;nbsp;to verify your signatures is the first thing that I would suggest.&amp;nbsp; Yes, this means that the trusty Win32 API book by Dan Appleman is a little out of date; however, it&amp;#39;s just the &amp;quot;signatures&amp;quot; that have to be dealt with since the .NET variety offers the granular level required to enable you to access **all** of the API available.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746735" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category></item><item><title>VB10 vs VB6: As Any</title><link>http://addressof.com/blog/archive/2011/05/31/VB10-vs-VB6_3A00_-As-Any.aspx</link><pubDate>Tue, 31 May 2011 04:13:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746732</guid><dc:creator>CorySmith</dc:creator><slash:comments>0</slash:comments><comments>http://addressof.com/blog/comments/746732.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746732</wfw:commentRss><description>&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;&lt;font color="#000000"&gt;This is part of series of posts categorized under &lt;/font&gt;&lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx"&gt;&lt;font color="#000000"&gt;VB10 vs VB6&lt;/font&gt;&lt;/a&gt;&lt;font color="#000000"&gt;.&lt;/font&gt;&amp;nbsp;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Consolas"&gt;&lt;font color="#0000ff"&gt;Declare Sub&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2"&gt; ExternalMethodName &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Lib&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;SomeLibrary&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&amp;nbsp;someValue &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Any&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Consolas" size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When working with Windows API&amp;#39;s, you use the DECLARE statement to define the external method.&amp;nbsp; In VB6, you could use the As Any variable declaration; doing so would allow you to pass &lt;strong&gt;any variable type&lt;/strong&gt; to the external method.&amp;nbsp; It&amp;#39;s key to note, when I say any, I mean &lt;strong&gt;any&lt;/strong&gt;.&amp;nbsp; VB6 would not protect you in any way against passing in something that you didn&amp;#39;t mean to do so.&amp;nbsp; Sure, this puts the responsiblity on the developer to do the right thing; however, last I checked, I now have 4 cores in my machine that are hyperthreaded providing 8 processing pipelines along with 16GB of memory.&amp;nbsp; I want my development environment to do everything it can to help me write better software.&amp;nbsp; Leaving it up to me to write comments or remember what types can be passed is kind of, well, annoying.&amp;nbsp; Wouldn&amp;#39;t it be great if there was some way that you could declare an external method that could support multiple valid appropriate variable types?&amp;nbsp; Oh wait, there is...&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Declare Sub&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; ExternalMethodName &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Lib&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&amp;quot;SomeLibrary&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; (&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; intValue &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Integer&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;)&lt;br /&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Declare&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Sub&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; ExternalMethodName &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;Lib&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&lt;font color="#a31515" face="Consolas" size="2"&gt;&amp;quot;SomeLibrary&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; (&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;ByVal&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; stringValue &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt; &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;String&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="2"&gt;&lt;font face="Consolas" size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;VB10 allows you to use overloaded method signatures.&amp;nbsp; As long as the parameters have a different signature, as defined by the number, order and type of parameters, you can create as many of these as you&amp;#39;d need.&amp;nbsp; By doing this, the IDE and compiler are able to protect you from passing in something you didn&amp;#39;t mean to, thus helping you to write better applications.&amp;nbsp; And when using these externally defined methods, the correct one will be automatically utilized based on the&amp;nbsp;variable type that you use.&lt;/p&gt;
&lt;p&gt;Verdict:&lt;/p&gt;
&lt;p&gt;So although VB10 does not support As Any, I&amp;#39;d say that this is a case where the language has evolved and&amp;nbsp;it&amp;#39;s a solid step in the right direction.&amp;nbsp; When moving to VB10, the IDE is really great about pointing out what variable type(s) you might be using and it takes only moments to rid yourself of the troublesome As Any pitfalls utilizing overloaded declares.&amp;nbsp; With that said, I&amp;#39;m going to give this one to VB10.&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746732" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category></item><item><title>VB10 vs VB6: VarPtr, StrPtr, ObjPtr</title><link>http://addressof.com/blog/archive/2011/05/30/VB10-vs-VB6_3A00_-VarPtr_2C00_-StrPtr_2C00_-ObjPtr.aspx</link><pubDate>Sun, 29 May 2011 22:12:00 GMT</pubDate><guid isPermaLink="false">71d585fb-e1da-4feb-ae24-6d48b96093ce:746727</guid><dc:creator>CorySmith</dc:creator><slash:comments>1</slash:comments><comments>http://addressof.com/blog/comments/746727.aspx</comments><wfw:commentRss>http://addressof.com/blog/commentrss.aspx?PostID=746727</wfw:commentRss><description>&lt;p&gt;This is part of series of posts categorized under &lt;a href="http://addressof.com/blog/archive/2011/05/29/VB10-vs-VB6-_2800_aka-VB.FRED_2900_.aspx"&gt;VB10 vs VB6&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;As it turns out, I still have a copy of Microsoft Visual Basic 6.0 Programmer&amp;#39;s Guide.&amp;nbsp; This was an excellent resource for learning VB6 and it&amp;#39;s what I&amp;#39;ll be using&amp;nbsp;as a&amp;nbsp;reference in these posts for comparison.&lt;/p&gt;&lt;p&gt;With that said, I have to point immediately that VarPtr, StrPtr and ObjPtr are *NOT* mentioned in this Programmer&amp;#39;s Guide.&amp;nbsp; These were functions that were &amp;quot;somewhat undocumented&amp;quot; and were only used by developers whom were pushing the limits of VB6 well beyond its original design and/or where they needed to work around the inherent limitations of the IDE, language and or runtime.&lt;/p&gt;&lt;p&gt;Don&amp;#39;t get me wrong, they were used in nearly every serious application ever developed in VB6; mainly by people who copied and pasted code they found elsewhere to work around the&amp;nbsp;limitations in VB6 as time and technology&amp;nbsp;marched beyond 1998.&amp;nbsp; Many of these developers had no fundamental idea of how these procedures they where&amp;nbsp;utilizing actually worked under the hood, they were just trying to get their job done.&lt;/p&gt;&lt;p&gt;When I was upgrading projects from VB6 to VB7, I encountered a ton of these with the highest encountered one being related to mouse/keyboard &amp;quot;hooking&amp;quot;.&amp;nbsp; In every case, I found built in functionality either in VB, Windows Forms&amp;nbsp;or .NET that completely removed the need to utilize these &amp;quot;hacks&amp;quot;.&lt;/p&gt;&lt;p&gt;With all that said, I find it interesting that Karl maintains the &amp;quot;&lt;a href="http://vb.mvps.org/tips/varptr.asp"&gt;Unofficial Documentation for VarPtr, StrPtr, and ObjPtr&lt;/a&gt;&amp;quot;.&amp;nbsp; On this document, he states:&lt;/p&gt;&lt;p&gt;&lt;em&gt;&amp;quot;The VarPtr function has been in the BASIC language since long before it turned 
into QuickBasic and Visual Basic. VarPtr has been in the VB runtime since 
version 1.0.&amp;quot;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;According to a post found &lt;a href="http://www.xtremevbtalk.com/showthread.php?t=35137"&gt;here&lt;/a&gt;, VARPTR is one of the keywords that is specifically mentioned as being &amp;quot;keywords that are either not supported by VB or are being used in different  context, or, have become properties/methods of some VB objects (and therefore  could not stand as an independent statement)&amp;quot;.  It&amp;#39;s been so long since I&amp;#39;ve used QB that I can&amp;#39;t remember any of specifics one way or the other.&lt;/p&gt;&lt;p&gt;I find it interesting that he points out that VarPtr was in QB; however, fails to mention that it worked a little bit differently... a complaint that he is making with the move to newer versions of VB.&amp;nbsp; I also suspect that there would have been some changes between its usage in in VB1 though VB4 when you transitioned from 16-bit to 32-bit.&amp;nbsp; What makes all the more interesting is actually reading his unofficial documentation where he points out that there are differences between VB4, VB5 and VB6 with this functionality and the work arounds you have to do to get it to be &amp;quot;right&amp;quot;.&amp;nbsp; And he complains about the &amp;quot;duct tape&amp;quot; solution provided by VarPtr, et. al. being removed?&amp;nbsp; &lt;/p&gt;&lt;p&gt;So what can one do when moving to VB10?&lt;/p&gt;&lt;p&gt;I have to point out that many of the hacks that were required in VB6 that leveraged these keywords are no longer needed with specific regards to Windows development.&amp;nbsp; Additionally, for the times that this is not the case, the Win32 interop story in VB10 is much, much, much better.&amp;nbsp; Additionally, it&amp;#39;s all 100% documented and 100% supported. ;-)&lt;/p&gt;&lt;p&gt;Note: If someone would like to send me an small example of where these keywords&amp;nbsp;were needed, I&amp;#39;d be happy to provide details about why they are no longer needed or how to leverage the Win32 API using VB10 in the cases where&amp;nbsp;built in functionality does not&amp;nbsp;already exist.&amp;nbsp;&amp;nbsp; It&amp;#39;d be nice to have a specific example on this for future reference.&lt;/p&gt;&lt;p&gt;Verdict:&lt;/p&gt;&lt;p&gt;Given that these functions were for the elite of the elite VB developers; I&amp;#39;m going to go out on a limb here and state that if you could hack your way through things in this manner, leveraging the documented methods in .NET should make things a whole lot simpler.&amp;nbsp; For those that were just needing the results of these creative coders, a lot of this functionality is &amp;quot;included in the box&amp;quot;.&amp;nbsp; Given those two factors, VB10 wins.&lt;/p&gt;&lt;p&gt;Updates(s):&lt;/p&gt;&lt;p&gt;&lt;a href="http://msmvps.com/blogs/bill/Default.aspx"&gt;Bill McCarthy&lt;/a&gt; (MVP) writes in: &amp;quot;StrPtr was often needed when calling Unicode API (assuming you pre-allocated the string) ObjPtr was sometimes used with windows subclassing calls: Was fraught with danger. I think Karl Peterson finally wrote an article for VSM a year or two ago admitting that using ObjPtr with subclassing could result in the wrong instance being called, and recommended to folks the use an external library for subclassing (one that ships with XP or later I think). Was kind-of funny to see it only took 10 years to admit it (lol).&amp;quot;&lt;/p&gt;&lt;p&gt;My only reply: :-)&lt;/p&gt;&lt;img src="http://addressof.com/aggbug.aspx?PostID=746727" width="1" height="1"&gt;</description><category domain="http://addressof.com/blog/archive/tags/VB6/default.aspx">VB6</category></item></channel></rss>
