How does the array initialize?

Hi,
image

Source: Assign
Message: Object reference not set to an instance of an object.

Main.xaml (6.3 KB)

May How to run normally?

New String(99){}
Can run

Thanks!

Hi @Phox

Your assign statement is fine. Why that error comes is because your array is not initialized in the variables panel.

So for your str array under default column in variables panel add the below code to initialize it

New Array(Of String)

Now your assign will work fine :slight_smile:

Let know if this works for you

1 Like

@Phox

Kindly use list instead of array if you are not sure of number of values you are store in a collection…use array…only when you are sure about the number of values to be stored…

Ok coming to the point…
Initialize array for a string like
New string[size of the array]. Or
New Int[size of the array]

For list
New list(of string)
New list(of int32)
But use add to collection activity to add data to a list…

Hope this would help you

Cheers…!

6 Likes

Hello @Phox,

You are initializing the array with value . If I understand well with your image presentation.

Two ways you can able to initialize the array with value.

  1. You can initialize in the variable panel. like below
    image

  2. Using the assign activity like below.
    image


To know more about this. please take a look this site.
https://www.dotnetperls.com/array-vbnet


Regards
Balamurugan.S

6 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.