0

I'm a beginner in VB and have an assingment where i have to use array, using input box to recieving array from t he user, such as first name and surname. then that array has to show in a listbox on the screen, does anyone know where i could begin, the amount of array should only be 11 names. thanks.

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by selvaganapathy
0

Hi
Array can be declared

[B]Dim Names([/B] [I]array_starting_index [/I][B]To[/B] [I]array_ending_index for first dimension[/I] , again for second dimension [B]) as[/B] DataType

Example
  Dim FName (10) as String

If array_starting_index is not mention then It takes default value 0
and Ending Index is 10. Totally 11 FirstNames it can contain.

I give an Example Program to read 11 Number from InputBox
> Open New Project in VB6
> Draw a ListBox (List1)
and try the below coding

'Form Level
  Dim Numbers(10) as Integer

  Private sub Form_Load()
   Dim i as Integer
   For i = 0 to 10
       Numbers (i) = Val(InputBox ("Enter Any Number"))
       List1.AddItem Numbers(i)
   Next i
 End sub

This is similar to Read 11 First name and Surname. You can Extend this with slight modification.
I Hope this will help u.

This topic has been dead for over six months. 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.