0

What is the right way to declare an array

Dim lblname As Label() = New Label(get_num_of_children()) {}
Dim mealcheck As Integer() = New Integer(get_num_of_children()) {}

or

Dim lblname() As Label = New Label(get_num_of_children()) {}
Dim mealcheck() As Integer = New Integer(get_num_of_children()) {}

Thanks for your help

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ninjatalon
1

If your declaring an array with a initial number you should use:

Dim MealCheck(get_num_of_children) as Integer

If you want to set the array with initial values you should use:

dim MealCheck() as integer = {1,2,3}

If you want to create an empty array you should use:

dim MealCheck() as integer = new integer(){}
Votes + Comments
THanks for you Help
0

Thanks I guess I was using the syntax wrong but it still worked. I'm correcting my arrays now.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.