With VB, what does "()" do after a word?
To find out what Mehrdad said:
The following lines use "()" to declare arrays:
'dynamic array w/o pre-set length'
Dim Doubles() As Double
'array of length 11'
Dim Doubles(10) As Double
'array of Strings initialized with three items'
Dim Strings() As New String() {"String1", "String2", "String3"}
The next line does NOT declare an array:
'here the "()" are treated as a call to the MyObject constructor'
Dim MyObjects As New MyObject()
a source to share
Methods
If you look at Console.WriteLine the commonly used forms of this method take one or more arguments, eg.
Console.WriteLine("Hello World")
However, one overload takes no parameters and just prints an empty string
Console.WriteLine()
Empty braces indicate a method call with no arguments.
Arrays
Dim s as String ' declares one string
Dim as(10) as string ' declares 11 strings, accessed by position
The following are to declare variables that will later be assigned an array of strings.
Dim n() as string
Dim m as string()
a source to share
Parathesis exists for function or method calls. For example, if you have a method named Run, you would name it by specifying MyDog.Run ()
Properties and regular variables are different and don't use paranthesis. For example, MyDog.FurColor = Blue
Some functions take parameters. In our example, the parameter could be how far to work. So MyDog.Run (10)
But given your other questions, you probably already know the answer to this question ...
a source to share