i am having problems putting text from 8 tb's on a dialog form into an array and passing the data back to a mainform as a single object, i then want to put this object into an array of like objects and be able to display each of the values/references from a selected object in the mainform array of objects.
NE help would be greatly appreciated as i have read all the articles on arrays i can find and am still having trouble understanding them.
eg
df = dialogform
on dialogform OK click
dialogform.stringMsg() = an array of 8 textbox values
add stringMsg to mainform.objarray
mainform.list.add objarray
mainform.label.text = list.objarray.selectedValue
''''each of the values in the original stringMsg go into the label or to seperate textboxes''''
this is the basic structure of what i want to accomplish

array questions for a VB Learner?
MarkEck911
maige
then add the class to the mainform array is that right, like i said still learning,
so bear with me please, then i can call array.person.name or id or address orany other propertie of the person/class in the array
UnknownTT
Boris Vidolov MSFT
this is in the class that creates the object to format
Public Overrides Function ToString() As String ' Normally ToString returns the fully qualified typename. ' In this example it would be VBNET.HowTo.Arrays.Customer ' We are overriding it so that we can return a simple ' display string when we're added to a list box. Return String.Format("Id={0}, Name={1}", Me.Id, Me.Name) End Function
this displays the data Private Sub DisplayArrayData(ByVal arr As Array) Dim i As Integer Dim u As Integer = (arr.Length - 1) Me.listbox.Items.Clear() For i = 0 To u Me.listbox.Items.Add(String.Format("{0} = {1}", i, arr.GetValue(i).ToString())) Next End Sub
Kmaure1
Mateusz www.Kierepka.pl
eg
Persons Array on mainform
string array on dialog form
add string array to Persons array
then display a selected person from Persons array
God_Mark
No - person.name is what you want.
me.label.text = person(i) & vbcrlf
No, the easiest thing to do is define ToString() so person(i).ToString prints out all of the details in the format you want
me.label.text = me.label.text & obj & vbcrlf
No, again, you need to use ToString, or some other method to format the data
poliveira
'will it display name
me.label.text = person(name) 'name of person in people array
'and will this display all of a person 'person created from class
for i = 0 to 7
me.label.text = person(i) & vbcrlf
'and this will display all people ' group or array of person(s)
for each obj in people
me.label.text = me.label.text & obj & vbcrlf