<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>Visual Basic Frequently Asked Questions : Language</title><link>http://blogs.msdn.com/vbfaq/archive/tags/Language/default.aspx</link><description>Tags: Language</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How do I determine the difference between two dates?</title><link>http://blogs.msdn.com/vbfaq/archive/2004/05/30/144571.aspx</link><pubDate>Sun, 30 May 2004 08:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:144571</guid><dc:creator>vbfaq</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/vbfaq/comments/144571.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vbfaq/commentrss.aspx?PostID=144571</wfw:commentRss><description>&lt;P&gt;Posted by: &lt;A href="http://weblogs.asp.net/duncanma"&gt;Duncan Mackenzie&lt;/A&gt;, MSDN&lt;BR&gt;&lt;EM&gt;This post applies to Visual Basic .NET 2002/2003&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This&amp;nbsp;common question is often phrased as "How do I find the number of hours between two dates?", substituting minutes, seconds, days, or whatever interval you are looking for in the place of 'hours'. Well, in Visual Basic .NET there are two main ways to achieve this result; &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctdatediff.asp"&gt;the DateDiff function&lt;/A&gt; or through &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtimespanclasstopic.asp"&gt;the TimeSpan structure&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Both of these methods are equally valid, where they overlap in functionality, but each of them has a couple of unique features.&amp;nbsp; Despite their similar functions, the core difference between the two is that DateDiff is a function, so you need to call it every time you need to retrieve a value, whereas TimeSpan is a structure that is created once and then you just work with its various members as needed.&lt;/P&gt;
&lt;P&gt;Using DateDiff, you call it with different date interval parameters to retrieve the appropriate value:&lt;BR&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;Dim&lt;/SPAN&gt;&lt;SPAN&gt; D1, D2 &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;As&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;Date&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; D1 = &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;Date&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Courier New"&gt;Now&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; D2 = #11/9/2004#&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #008000; FONT-FAMILY: Courier New"&gt;'DateDiff&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"DateDiff"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"{0} Days"&lt;/SPAN&gt;&lt;SPAN&gt;, _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;DateDiff&lt;/SPAN&gt;&lt;SPAN&gt;(DateInterval.&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;Day&lt;/SPAN&gt;&lt;SPAN&gt;, D1, D2))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"{0} Hours"&lt;/SPAN&gt;&lt;SPAN&gt;, _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;DateDiff&lt;/SPAN&gt;&lt;SPAN&gt;(DateInterval.&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;Hour&lt;/SPAN&gt;&lt;SPAN&gt;, D1, D2))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"{0} Minutes"&lt;/SPAN&gt;&lt;SPAN&gt;, _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;DateDiff&lt;/SPAN&gt;&lt;SPAN&gt;(DateInterval.&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;Minute&lt;/SPAN&gt;&lt;SPAN&gt;, D1, D2))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"{0} Seconds"&lt;/SPAN&gt;&lt;SPAN&gt;, _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;DateDiff&lt;/SPAN&gt;&lt;SPAN&gt;(DateInterval.&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;Second&lt;/SPAN&gt;&lt;SPAN&gt;, D1, D2))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine()&lt;/SPAN&gt;&lt;/PRE&gt;&lt;SPAN&gt;Alternatively, a TimeSpan structure can be retrieved as the result of subtracting one date from another, and then querying the various members of that structure.&lt;/SPAN&gt;&lt;PRE&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #008000; FONT-FAMILY: Courier New"&gt;'TimeSpan&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"TimeSpan"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;Dim&lt;/SPAN&gt;&lt;SPAN&gt; difference &lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #0000ff; FONT-FAMILY: Courier New"&gt;As&lt;/SPAN&gt;&lt;SPAN&gt; TimeSpan = D2.Subtract(D1)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"{0} Days"&lt;/SPAN&gt;&lt;SPAN&gt;, difference.TotalDays)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"{0} Hours"&lt;/SPAN&gt;&lt;SPAN&gt;, difference.TotalHours)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"{0} Minutes"&lt;/SPAN&gt;&lt;SPAN&gt;, difference.TotalMinutes)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(&lt;/SPAN&gt;&lt;SPAN style="FONT-WEIGHT: 400; FONT-SIZE: 12px; COLOR: #ff0000; FONT-FAMILY: Courier New"&gt;"{0} Seconds"&lt;/SPAN&gt;&lt;SPAN&gt;, difference.TotalSeconds)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine()&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;The output of the two different methods is nearly identical, except that the TimeSpan properties are returning Doubles, while DateDiff always returns Longs (Int64).&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;DateDiff&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;175 Days&lt;BR&gt;4222 Hours&lt;BR&gt;253345 Minutes&lt;BR&gt;15200730 Seconds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;TimeSpan&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;175.934383644387 Days&lt;BR&gt;4222.42520746528 Hours&lt;BR&gt;253345.512447917 Minutes&lt;BR&gt;15200730.746875 Seconds&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The fractional values returned from the TimeSpan properties are more meaningful that they might seem at first glance; each of these properties is returning the complete difference between the two dates, whereas the whole numbers returned from DateDiff only provide a value to within one interval (day, hour, etc&amp;#8230;). Using only one of these properties from TimeSpan, it would be possible to figure out any other time interval (with varying degrees of precision, of course), although that calculation would seldom be required in practice.&lt;/P&gt;
&lt;P&gt;The TimeSpan structure provides additional members (.Hours, .Days, etc...) that return values closer to what you see from DateDiff, so you can use those if it is more suitable for your situation. While TimeSpan can appear to have more features and to be more efficient,&amp;nbsp;DateDiff has two benefits that may cause you to continue to use it in your Visual Basic .NET applications:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;It&amp;nbsp;provides several date intervals that are not covered by TimeSpan, including Weeks and Quarters, and 
&lt;LI&gt;It is compatible with the VB6 function of the same name, allowing you to more easily reuse existing code.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;Read the corresponding documentation for more information, but I hope that this has been helpful...&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctdatediff.asp"&gt;DateDiff&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtimespanclasstopic.asp"&gt;TimeSpan&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;BR&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=144571" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vbfaq/archive/tags/Language/default.aspx">Language</category><category domain="http://blogs.msdn.com/vbfaq/archive/tags/General/default.aspx">General</category></item><item><title>Workaround: Arrays with non-zero lower bounds</title><link>http://blogs.msdn.com/vbfaq/archive/2004/04/20/116660.aspx</link><pubDate>Tue, 20 Apr 2004 10:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:116660</guid><dc:creator>vbfaq</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/vbfaq/comments/116660.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vbfaq/commentrss.aspx?PostID=116660</wfw:commentRss><description>&lt;P&gt;Posted by: &lt;A href="http://www.philweber.com/"&gt;Phil Weber&lt;/A&gt;, VB &lt;A href="http://mvp.support.microsoft.com/default.aspx?scid=fh;EN-US;mvpintro"&gt;MVP&lt;/A&gt;&lt;BR&gt;&lt;EM&gt;This post applies to Visual Basic .NET 2002/2003/2005&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;OK, now that &lt;A href="http://panopticoncentral.net/articles/950.aspx"&gt;Paul Vick&lt;/A&gt; has explained why VB.NET doesn't support arrays with non-zero lower bounds, let's see how we can do them anyway. ;-)&lt;/P&gt;
&lt;P&gt;Say you want to store a collection of annual values in an array of integers. It's reasonable that the array index would correspond to the year in question; that is, &lt;FONT face="Courier New"&gt;TotalSales(1981)&lt;/FONT&gt; would contain the sales total for the year 1981.&lt;/P&gt;
&lt;P&gt;In pre-.NET versions of VB, we could simply do this: &lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;TotalSales(1981 To 2000)&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;As Integer&lt;/FONT&gt;
&lt;/PRE&gt;Problem solved. But as Paul has explained, VB.NET no longer lets us do that. We can, however, do this: &lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Dim&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;TotalSales&amp;nbsp;&lt;FONT color=#0000ff&gt;As New&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;VBArray(1981, 2000)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TotalSales(1981) = 345
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TotalSales(2000) = 995
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(TotalSales(1981))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Console.WriteLine(TotalSales(2000))&lt;/FONT&gt;
&lt;/PRE&gt;I can live with that, how about you? 
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;This class (based on &lt;A href="http://blogs.msdn.com/ericgu/archive/2004/03/18/92353.aspx"&gt;this post&lt;/A&gt; by &lt;A href="http://blogs.msdn.com/ericgu/"&gt;Eric Gunnerson&lt;/A&gt;) is what makes it all possible: &lt;PRE&gt;&lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Class&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;VBArray&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;_lbound&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Private&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;_int&lt;/FONT&gt;&lt;FONT color=black&gt;()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt; &lt;BR&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;New&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#000080&gt;LBound&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#000080&gt;UBound&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=black&gt;Me&lt;/FONT&gt;&lt;FONT color=black&gt;.&lt;/FONT&gt;&lt;FONT color=black&gt;ReDim&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=#000080&gt;LBound&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#000080&gt;UBound&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; &lt;BR&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;[ReDim]&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#000080&gt;LBound&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;&lt;FONT color=black&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#000080&gt;UBound&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=black&gt;_lbound&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#804040&gt;=&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#000080&gt;LBound&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;ReDim&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;_int&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=#000080&gt;UBound&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#804040&gt;-&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#000080&gt;LBound&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#804040&gt;+&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;1&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Sub&lt;/FONT&gt; &lt;BR&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Default&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Property&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Item&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Index&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;&lt;FONT color=black&gt;)&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Get&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Return&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;_int&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=black&gt;Index&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#804040&gt;-&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;_lbound&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Get&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Set&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ByVal&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Value&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;&lt;FONT color=black&gt;)&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=black&gt;_int&lt;/FONT&gt;&lt;FONT color=black&gt;(&lt;/FONT&gt;&lt;FONT color=black&gt;Index&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#804040&gt;-&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;_lbound&lt;/FONT&gt;&lt;FONT color=black&gt;)&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#804040&gt;=&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Value&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Set&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Property&lt;/FONT&gt; &lt;BR&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Public&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Function&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#000080&gt;ToArray&lt;/FONT&gt;&lt;FONT color=black&gt;()&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;As&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;Integer&lt;/FONT&gt;&lt;FONT color=black&gt;()&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;Return&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=black&gt;_int&lt;/FONT&gt;
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Function&lt;/FONT&gt;
 &lt;FONT color=#0000ff&gt;End&lt;/FONT&gt;&amp;nbsp;&lt;FONT color=#0000ff&gt;Class&lt;/FONT&gt;
&lt;/PRE&gt;I've included a &lt;EM&gt;ToArray&lt;/EM&gt; method which returns the underlying array, in case you need to pass it to another method, or manipulate it in other array-type ways. 
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Note that this class is hard-coded to handle Integers; in VB.NET 2002/2003, you must create a separate class for each array type you wish to simulate. &lt;A href="http://weblogs.asp.net/duncanma/archive/2004/02/19/76587.aspx"&gt;Generics&lt;/A&gt; in Visual Basic .NET 2005 will make this sort of thing much cleaner.&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=116660" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vbfaq/archive/tags/Language/default.aspx">Language</category></item><item><title>Why doesn't VB support non-zero lower bounds for arrays? </title><link>http://blogs.msdn.com/vbfaq/archive/2004/04/20/116636.aspx</link><pubDate>Tue, 20 Apr 2004 10:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:116636</guid><dc:creator>vbfaq</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vbfaq/comments/116636.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vbfaq/commentrss.aspx?PostID=116636</wfw:commentRss><description>&lt;p&gt;Posted by: &lt;a href="http://weblogs.asp.net/duncanma"&gt;Duncan Mackenzie&lt;/a&gt;, MSDN&lt;br /&gt;&lt;em&gt;This post applies to Visual Basic .NET 2002/2003/2005&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Another answer from &lt;a href="http://panopticoncentral.net/"&gt;Paul Vick&lt;/a&gt;, Technical Lead on VB.NET, explaining the changes in array bounds from Visual Basic 6.0:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;&lt;font color="#800080"&gt;&lt;a href="http://panopticoncentral.net/articles/950.aspx"&gt;Why doesn't VB support non-zero lower bounds for arrays?&lt;/a&gt;&lt;/font&gt;&lt;/u&gt;&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;&lt;em&gt;... We allowed programmers to declare arrays that had bounds from 1 to 20, or from 1001 to 2000 or whatever. Even more puzzling, &lt;a href="http://weblogs.asp.net/ericgu/archive/2004/03/16/90724.aspx"&gt;Eric&lt;/a&gt; points out that the CLR does support such arrays. So if there's no historical problem and there's no technical problem, why doesn't VB have non-zero lower bound arrays? ... &lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=116636" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vbfaq/archive/tags/Language/default.aspx">Language</category></item><item><title>Why did Visual Basic .NET introduce AndAlso and OrElse? </title><link>http://blogs.msdn.com/vbfaq/archive/2004/04/20/116591.aspx</link><pubDate>Tue, 20 Apr 2004 07:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:116591</guid><dc:creator>vbfaq</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vbfaq/comments/116591.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vbfaq/commentrss.aspx?PostID=116591</wfw:commentRss><description>&lt;p&gt;Posted by: &lt;a href="http://weblogs.asp.net/duncanma"&gt;Duncan Mackenzie&lt;/a&gt;, MSDN&lt;br /&gt;&lt;em&gt;This post applies to Visual Basic .NET 2002/2003/2005&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://panopticoncentral.net/"&gt;Paul Vick&lt;/a&gt;, Technical Lead on VB.NET, and the author of the Visual Basic .NET Language Specification, &lt;a href="http://panopticoncentral.net/articles/919.aspx"&gt;discusses&lt;/a&gt; the new short-circuiting boolean operators added in Visual Basic .NET 2002.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href="http://panopticoncentral.net/articles/919.aspx"&gt;&lt;strong&gt;Why did we introduce AndAlso and OrElse?&lt;/strong&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;em&gt;... Prior to VB.NET, the VB language only had the And and Or operators. They were essentially bitwise operators, which means that they took their two operands and performed an AND or OR operation on each bit position to produce the resulting bit... &lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=116591" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vbfaq/archive/tags/Language/default.aspx">Language</category></item><item><title>Operator Overloading?</title><link>http://blogs.msdn.com/vbfaq/archive/2004/04/19/116561.aspx</link><pubDate>Tue, 20 Apr 2004 06:54:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:116561</guid><dc:creator>vbfaq</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/vbfaq/comments/116561.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vbfaq/commentrss.aspx?PostID=116561</wfw:commentRss><description>&lt;P&gt;Posted by: &lt;A href="http://www.philweber.com/"&gt;Phil Weber&lt;/A&gt;, VB &lt;A href="http://mvp.support.microsoft.com/default.aspx?scid=fh;EN-US;mvpintro"&gt;MVP&lt;/A&gt;&lt;BR&gt;&lt;EM&gt;This post applies to Visual Basic .NET 2005 (&amp;#8220;Whidbey&amp;#8221;)&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://altinoren.com/"&gt;Gokhan Altinoren&lt;/A&gt; asks: 
&lt;BLOCKQUOTE&gt;&lt;EM&gt;What was the design decision behind the fact that VB.NET does not support operator overloading? Will this feature be in the VB.NET specification in the future?&lt;/EM&gt; &lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Sadly, the VB team failed to consult me while they were designing the language, so I can't comment on why they decided not to support operator overloading in VB.NET (although if I had to guess, I'd wager that it was on the list of &amp;#8220;nice-to-have&amp;#8221; features that had to be postponed in order to ship VB.NET during the Bush administration).&lt;/P&gt;
&lt;P&gt;The good news is that it is slated for the next release of VB (Visual Basic .NET 2005, code-named &lt;EM&gt;Whidbey).&lt;/EM&gt; For more information, see: 
&lt;BLOCKQUOTE&gt;&lt;A href="http://blogs.gotdotnet.com/cambecc/permalink.aspx/5de5a161-9150-4237-a751-127195cceeab"&gt;http://blogs.gotdotnet.com/cambecc/permalink.aspx/5de5a161-9150-4237-a751-127195cceeab&lt;/A&gt;&lt;BR&gt;&lt;A href="http://weblogs.asp.net/cfranklin/archive/2003/11/14/37580.aspx"&gt;http://weblogs.asp.net/cfranklin/archive/2003/11/14/37580.aspx&lt;/A&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=116561" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vbfaq/archive/tags/Language/default.aspx">Language</category><category domain="http://blogs.msdn.com/vbfaq/archive/tags/Visual+Basic+2005+_2800_Whidbey_2900_/default.aspx">Visual Basic 2005 (Whidbey)</category></item></channel></rss>