Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help I cant even create a simple array...

Status
Not open for further replies.

barant

Programmer
Aug 6, 2003
12
US
I have a textbox called txtLastName
When I click submit I want the text from the box to go into value 0 of the array.
When they add another name in the box insert it into value 1 of the same array. I have been fooling for almost 2 hours and couldnt even get this to work. Please Help
 
Dim ar() As String = {"Foo", "Bar"}
Dim str As String
For Each str In ar
Console.WriteLine(str.ToString)
Next


ms-help://MS.VSCC.2003/MS.MSDNQTR.2003APR.1033/cpref/html/frlrfSystemArrayClassTopic.htm

goto this link which points to help files in vs.net.

Scott
Programmer Analyst
<{{><
 
Use the new arraylist collection. It will automaticly resize itself so you dont need to worry about using redim preserve to resize your array. You can do this in an arrya but it is much eaiser using the new Arraylist

Dim myArray As New ArrayList

Private Sub Button1_Click(ByVal ...) Handles Button1.Click

myArray.Add(TextBox1.Text)

myArray.TrimToSize()

End Sub



'When you are done trim the arraylist to the amount of items in it

myArray.TrimToSize()



DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb

-----------------------------------

If you can't explain it simply, you don't understand it well enough.
- A. Einstein





 
Ignore the TrimToSize inside the button click event

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb

-----------------------------------

If you can't explain it simply, you don't understand it well enough.
- A. Einstein





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top