On 28 Oct 2003 23:08:31 +0100, Herfried K. Wagner [MVP] wrote:
* "Dave" <an*******@discussions.microsoft.com> scripsit: Anyone else wish Vb.Net had a continue keyword such as
that in C based languages? It would be nice to send
execution to the begining of the loop without having
to 'GoTo'.
In a weblog I read that they will introduce it in Whidbey. Maybe it's
rumor, I don't know.
;-)
At this location is information on the new version of Visual Basic:
http://msdn.microsoft.com/vbasic/whidbey/
It includes Generics, Operator Overloading, Unsigned Types, Using Block,
and the Continue Statement. It gives exmples of the Continue statement
like this:
Public Sub PeterPiper()
Dim s As Char() = "peter piper picked pickled peppers"
Dim i As Integer
For i = 0 To (s.Length() - 1)
'interested only in p's
If Not (s(i).Equals("p"c)) Then Continue For
s(i) = "P"c
Next
Console.WriteLine(s)
End Sub
And the Using Block:
Imports System.Drawing
Sub Main()
'Create a new font object using expensive system
'resources.
Using theFont As New Font("Arial", 10.0F)
txtFontA.Font = theFont
txtFontA.Text = "Hello Bebbe Cow!"
End Using
'The Dispose method has been called on our Font
'releasing the system resources.
'Repeat the process reading text from a file.
'Note that the filename is invalid in this case.
Dim sFilename As String = "C:\Invalid*Test*File"
Using theFont As New Font("Arial", 10.0F)
txtFontA.Font = theFont
'This will throw an exception because the filename is invalid
txtFontA.Text=My.Computer.FileSystem.ReadAllText(s Filename)
End Using
'The dispose method has been called even though
Ąthe code threw an exception.
End Sub
Very interesting and exciting changes for VB ahead!
--
Chris
To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
address.