Text Box and List Box

  • Thread starter Thread starter flyingwhiz
  • Start date Start date
F

flyingwhiz

Hi,

I have a text box and list box on my form.What ever the value I enter
in text box it shud go into list box.

I added this code "lstItems.Items.Add(txtVal.Text)" as below

Private Sub txtVal_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles txtScanVal.TextChanged

lstItems.Items.Add(txtVal.Text)

txtVal.Text = ""

End Sub

When I am trying this..it's reading each value in list box. suppose if
I enter 'name' in text box.In list box it enters as..n,na,nam,name.so
how to send the full text lenght value in to the list box.I want it to
be just one item in the list box with appended text.
Can someone give me some idea How to handle this ?'

Thanks
Whiz
 
The user has to have some way of informing you that they have finished
typing and want to add the item to the ListBox. E.g. stick a button on there
and when they press it add the text. You could also do it in the
TextBox.LostFocus event but I would suggest there was a more obvious way.
Naturally this highlights the ability to remove items from the list as well
should a string gets erroneously added.

Cheers
Daniel
 
Back
Top