dot syntax and concatenated names
-
Can object names be designated in (VB.NET) dot syntax on the fly? e.g., in c#: for (i=0;i<5;i++){ ["bullet" + i].Text = list.ChildNodes[i].InnerText; } ...would work, but this VB doesn't seem to: For i = 0 To 4 ("bullet" & i).Text = list.ChildNodes(i).InnerText Next i Is there a syntax in VB.NET that allow such a thing?
-
Can object names be designated in (VB.NET) dot syntax on the fly? e.g., in c#: for (i=0;i<5;i++){ ["bullet" + i].Text = list.ChildNodes[i].InnerText; } ...would work, but this VB doesn't seem to: For i = 0 To 4 ("bullet" & i).Text = list.ChildNodes(i).InnerText Next i Is there a syntax in VB.NET that allow such a thing?
("bullet" & i). is interpreted as a string, try using the same syntax as in c# ["bullet" + i].Text = list.ChildNodes(i).InnerText
-
("bullet" & i). is interpreted as a string, try using the same syntax as in c# ["bullet" + i].Text = list.ChildNodes(i).InnerText
-
For i = 0 To 4 ("bullet" & i).Text = list.ChildNodes(i).InnerText Next i I didn't think it would work, that would 'break' vb's typing. I think that was part of the argument when they re-wrote sections before release. VB programmers panicked when they say what the new language was like. Personally the nearer to c# (apart from readability) the better.