Discussion
please help... I frigging hate VB -
I need an array of static final strings in VB (.NET)
Normally in C/Java I'd do
public final static string[] = new string {
"s1",
"s2",
"s3",
"s4"
};
How do I do the same in VB?
I know google is my friend - but after searching te top 20 pages I still didn't get an answer :(
many thanks
Ex
I need an array of static final strings in VB (.NET)
Normally in C/Java I'd do
public final static string[] = new string {
"s1",
"s2",
"s3",
"s4"
};
How do I do the same in VB?
I know google is my friend - but after searching te top 20 pages I still didn't get an answer :(
many thanks
Ex
Don said:
Why not just
Dim s(10) As String
s(1) = "s1"
s(2) = "s2"
etc?
OK. So you want to protect the strings from accidental overwrites - but hey! Its VB.
Hopefully a VB.NET person will be along with exactly what you want...
Have you tried looking up the syntax in C#?
Thanks Don
Well, Oh , I originally wrote the APP in C# and now I'm having to rewrite the whole bloody lot in VB so that 'other' people can maintain it.... still at least I'm getting paid to do it.
Did I mention that I hate coding VB almost as much as I hate HTML
ok, I'm still struggling with this -
Namespace I4Spots.spotmaps
Public Class spotstates
Public saSPOTSTATES As String() = {"Any", "G", "GL", "GLM", "GLMC"}
End Class
End Namespace
but saSPOTSTATES is not visible as a static member - as needed to populate a combobox with the array:
ComboBoxStates.Items.AddRange(spotstates.saSPOTSTATES)
What am I doing wrong?
Tried
Static saSPOTSTATES As String() = {"Any", "G", "GL", "GLM", "GLMC"} - tells me static is not a valid member definition?
It won't let me use Const either?
Jesus, how clumsy is this shit?
Namespace I4Spots.spotmaps
Public Class spotstates
Public saSPOTSTATES As String() = {"Any", "G", "GL", "GLM", "GLMC"}
End Class
End Namespace
but saSPOTSTATES is not visible as a static member - as needed to populate a combobox with the array:
ComboBoxStates.Items.AddRange(spotstates.saSPOTSTATES)
What am I doing wrong?
Tried
Static saSPOTSTATES As String() = {"Any", "G", "GL", "GLM", "GLMC"} - tells me static is not a valid member definition?
It won't let me use Const either?
Jesus, how clumsy is this shit?
RIchardD said:
www.dnzone.com/ShowDetail.asp?NewsId=356
Shows some differences between C# and vb.net
Static seems to mean different things between the two languages
Hallelujah, thanks Richard:
Public Class spotstates
Shared saSPOTSTATES As String() = {"Any", "G", "GL", "GLM", "GLMC"}
Public Shared Function getStateStrings() As String()
Return saSPOTSTATES
End Function
End Class
seems to have done it!
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff