• VB code "Dim Statements"
    11 replies, posted
Im learning Visual Basics and have trouble understanding Dim Statements Can any one help?
There's a programming subforum, you know that, right? And dim just basically says that the next word is the name of the variable. I prefer C#'s method of declaring variables, it isn't an anonymous type to begin with.
[QUOTE=robmaister12;24935140]I prefer C#'s method of declaring variables, it isn't an anonymous type to begin with.[/QUOTE] eh?
what the fuck am I saying, I need some sleep....
Well, to start, it Visual Basic. So the purpose of dim is to declare a variable I'm a bit rusty but heres how you could use it. [code] private sub form_load() dim a as integer dim name as string a = 1 name = "Bob" text1.text = a text2.text = name end sub [/code]
[QUOTE=matthall765;24935205]Well, to start, it Visual Basic. So the purpose of dim is to declare a variable I'm a bit rusty but heres how you could use it. [code] private sub form_load() dim a as integer dim name as string a = 1 name = "Bob" text1.text = a text2.text = name end sub [/code][/QUOTE] Thanks that helps
Dim, I think, stands for dimension (don't quote me on that) It basically reserves some space in memory for a variable of a specific type. You can use that variable to store values
[QUOTE=Chris220;24939027]Dim, I think, stands for dimension (don't quote me on that)[/QUOTE]
:arghfist::saddowns:
After a fairly nice amount of sleep and re-reading my post, I [I]think[/I] I meant that C# is easier to read because the variable type comes before the variable name instead of the dim statement there with the type at the end of the line. Or something like that...
Dim <variable name> as <variable type> you might also be able to throw stuff like shared, public, private before the variable type.
[QUOTE=RoBaDoB;24959522]you might also be able to throw stuff like shared, public, private before the variable type.[/QUOTE] To define them like that I think you replace Dim with those words, ie Public varname as String Private anothervariable as Integer
Sorry, you need to Log In to post a reply to this thread.