code++++++++++++
ProtectedSub btnAddList_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles btnAddList.Click
Dim strSelectionAsString
tempArray.Add(New userObject(txtlname2.Text, txtfname2.Text, txtmname2.Text))
tempArray.TrimToSize()
ForEach obj1In tempArray
strSelection = obj1.lastName &", " & obj1.firstName &", " & obj1.middleName
If Len(LTrim(strSelection)) > 0Then
ListBox1.Items.Add(strSelection)
ListBox1.SelectedIndex = 0
EndIf
Next
'clear text box
txtlname2.Text =""
txtfname2.Text =""
txtmname2.Text =""
EndSub
+++++++++++++++++++++++ProtectedSub ListBox1_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles ListBox1.SelectedIndexChanged
// not working does not see below...
ForEach obj1In tempArray
Response.Write("testing") //not working
txtlname2.Text = obj1.lastName
txtfname2.Text = obj1.firstName
txtmname2.Text = obj1.middleName
Next
cheetoz--Regarding this...
cheetoz wrote:
...to display the user info that was entered when the user select a name in the listbox.....i have tried to set the controls to the arraylist object in the selected change method in the listbox but it is not working ..............does anyone have any ideas......
...it may be the case that the ListBox needs to have autopostback="true" set in the code-infront.
Try that; it might help.
HTH.
Thank you.
the autopost back is already set.......i know it has something to do with my code but just can't figure it out........heres the logic to the code................when item is selected the coresponding item index number is used to select the array that contains the object that holds the user info, and then repopulate the controls .........i just don't know the code can someone provide me with some examples........thanks
Where are you declaring tempArray? Furthermore, where are you storing it? Remember that ALL variables get re-declared (and set to 0) on every PostBack unless you stick them in ViewState, Session, etc.
NC...
0 comments:
Post a Comment