|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Syntax not accepted on my version of VS why ?.The newbie strikes back, ;) I have downloaded several examples that contains that syntax : For i as integer = 0 to treeview.nodes.count - 1 Why my Vs 2002 (7.0) will NOT compile as per: "Name i is not declared"? Thanks to light me up on that one. Cheers! Marc R. Marc,
| For i as integer = 0 to treeview.nodes.count - 1 Simple! the syntax was introduced with VS 2003 (7.1) .NET 1.1.| Why my Vs 2002 (7.0) will NOT compile as per: "Name i is not declared"? -- Show quoteHide quoteHope this helps Jay [MVP - Outlook] ..NET Application Architect, Enthusiast, & Evangelist T.S. Bradley - http://www.tsbradley.net "Marc R." <Nospam@NewgroupsONLY.com> wrote in message news:ulXPrvjIGHA.964@tk2msftngp13.phx.gbl... | | Hi All, | | The newbie strikes back, ;) | | | | I have downloaded several examples that contains that syntax : | | | | For i as integer = 0 to treeview.nodes.count - 1 | | | | Why my Vs 2002 (7.0) will NOT compile as per: "Name i is not declared"? | | | | Thanks to light me up on that one. | | | | Cheers! | | | | Marc R. | | Marc,
The syntax "For i as integer" part was not yet in the version 2002. It has in 2002 to be \\\ dim i as integer For i = 0 to etc. /// I hope this helps, Cor Marc R. wrote:
> Hi All, The ability to declare loop variables 'in line' in this way was one of> > The newbie strikes back, ;) > > I have downloaded several examples that contains that syntax : > > For i as integer = 0 to treeview.nodes.count - 1 > > Why my Vs 2002 (7.0) will NOT compile as per: "Name i is not declared"? > only two substantive changes to the VB *language* between 2002 (7.0) and 2003 (7.1): >> What's New in Visual Basic .NET 2003Visual Basic .NET 2003 has added functionality that simplifies bit manipulation and loop variable declaration. Bit Shift Operators Visual Basic .NET now supports arithmetic left and right shift operations on integral data types (Byte, Short, Integer, and Long). Arithmetic shifts are not circular, which means the bits shifted off one end of the result are not reintroduced at the other end. The corresponding assignment operators are provided as well. Loop Variable Declaration Visual Basic .NET now allows you to declare a loop variable as part of a For or For Each loop. You can include an As clause for the variable in the For or For Each statement, provided no variable of that name has been declared outside the loop. The scope of a loop variable declared in this manner is the loop itself. >> If you regularly have to use both versions, you may want to 'avoidlearning' the new loop variable syntax (the bit shift operators are much less commonly encountered). The only accompanying *Framework* change that catches me out is the addition of DataReader.HasRows. -- Larry Lard Replies to group please "Marc R." <Nospam@NewgroupsONLY.com> schrieb: The inline variable declaration is only supported in VS.NET 2003 (VB 7.1) > I have downloaded several examples that contains that syntax : > > For i as integer = 0 to treeview.nodes.count - 1 > > Why my Vs 2002 (7.0) will NOT compile as per: "Name i is not declared"? and VS 2005 (VB 8.0). Instead you need a separate declaration: \\\ Dim i As Integer For i = 0 To ... ... Next i /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> is there an easy way to upgrade to 7.1 ?
Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:ODhwlmmIGHA.1032@TK2MSFTNGP11.phx.gbl... > "Marc R." <Nospam@NewgroupsONLY.com> schrieb: >> I have downloaded several examples that contains that syntax : >> >> For i as integer = 0 to treeview.nodes.count - 1 >> >> Why my Vs 2002 (7.0) will NOT compile as per: "Name i is not declared"? > > The inline variable declaration is only supported in VS.NET 2003 (VB 7.1) > and VS 2005 (VB 8.0). Instead you need a separate declaration: > > \\\ > Dim i As Integer > For i = 0 To ... > ... > Next i > /// > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> "Marc R." <Nospam@NewgroupsONLY.com> schrieb It was in 2003, when it came out ($20). You're a little late. Now version > is there an easy way to upgrade to 7.1 ? 2005 is out. Armin
DataGridView: Preventing deselection of a selected checkbox
Form Focus Issue Web activation Using Classes as List Items i can't round Best way to do a connection-oriented Send/Receive. need ideas - caching strategy Using a delegate Datareader binding to datagrid not working FileSystemWatcher UNC Path Invalid |
|||||||||||||||||||||||