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
TheExcession said:
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
Well - HTML I can deal with - but on the VB front... I'm with you.
There again: release after release they seem more and more determined to turn VB into the semblamce of a "proper" language. With the advent of .NET it should be capable of anything any of the other languages are - and its hard to get excited about clunky syntax as a fault.
Why on earth a client would pay you to re-write a C# app in VB is beyond me, though. I mean - how hard is C# to maintain if you know VB.NET! Libraries are all the same...how difficult is it to put a bleedin semi-colon on the ends of lines! MAD!
Still - enjoy the proceeds, mate. It's what it's all about.
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?
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
Shows some differences between C# and vb.net
Static seems to mean different things between the two languages
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!
TheExcession said:
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.
If it was me, I'd either run a C# -> VB.NET source munger, or (more likely) push the finished assemblies and executables through Reflector (with the file output add-in) and get it to dump out the whole source in VB.NET for you. Albeit with munged local variable names... a few hours of refactoring (and more importantly renaming) with Resharper and you can take the rest of the month off.
Managed to disassemble the whole of the System.Web assembly and get it to compile back up again (running correctly) in under two days once (all because some internal methods should've been public). And that one was an absolute pig - lots of unmanaged nastiness.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff