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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox adding new entry on button click

Status
Not open for further replies.

xtremeLogic

Programmer
Dec 19, 2003
53
CA
Hi,

I would like to add a row in a listbox based on the values of two text fields on the same form. Also, I would like to be able to delete certain rows in the listbox based on selection. I created an add button and entering the following code in the _Click Handler:
Code:
Dim strTo As String
strTo = ToCompany.Text + ", " + ToPerson.Text
lbToCompany.Items.Add(New ListItem(strTo))

but when I click on the button, it doesn't do anything the page just reloads with my various form validators becoming active. Any suggestions as to how to get this done?

Thanks.
 
It sounds like you are just reloading every time:

If Page.IsPostBack Then
do you stuff
Else
bind your listbox normally
End If

regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top