Combo Box and Text Box - Plz Help 
Author Message
 Combo Box and Text Box - Plz Help

When I select the item from combobox, I also want to update the text
in texbox.
So if I have a list of items(1,2,3) in combobox, when I select "1", it
should put "1" string in textbox. This works only one time.  So if I
change the selection to "2", my textbox text doesn't get change.  It
still show as "1"

Below is a part of my source code.

Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
  Dim box1 as New textbox()
  box1 = new textbox()
  box1.name = "box1name"
  box1.localtion = new system.drawing.point(50,344)
  box1.text = combobox1.text
  controls.add(box1)
End Sub

What am I doing wrong?
I also changed the texbox() to richtextbox(), still doesn't work.. :(
I'm just started to learn vb, so i'm very newbie.. :(

Thanks



Mon, 01 Aug 2005 07:16:16 GMT  
 Combo Box and Text Box - Plz Help

With the " Dim box1 as New textbox()"
you create a new Textbox every Time the User changes the Combobox...........

Draw a Text box in the Formular an simple say

Quote:
> Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> ComboBox1.SelectedIndexChanged
>   Textbox1.text = combobox1.text
> End Sub

If your goal is realy to create new textboxes than
you should give them all the same Position.

If you want to create the Textbox dynamicly
than put the go this way

Quote:
>   private box1 as New textbox()

private sub Form_Load............
Quote:
>   box1 = new textbox()
>   box1.name = "box1name"
>   box1.localtion = new system.drawing.point(50,344)

en sub

Quote:
> Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> ComboBox1.SelectedIndexChanged
>   box1.text = combobox1.text
> End Sub



Quote:
> When I select the item from combobox, I also want to update the text
> in texbox.
> So if I have a list of items(1,2,3) in combobox, when I select "1", it
> should put "1" string in textbox. This works only one time.  So if I
> change the selection to "2", my textbox text doesn't get change.  It
> still show as "1"

> Below is a part of my source code.

> Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As
> System.Object, ByVal e As System.EventArgs) Handles
> ComboBox1.SelectedIndexChanged
>   Dim box1 as New textbox()
>   box1 = new textbox()
>   box1.name = "box1name"
>   box1.localtion = new system.drawing.point(50,344)
>   box1.text = combobox1.text
>   controls.add(box1)
> End Sub

> What am I doing wrong?
> I also changed the texbox() to richtextbox(), still doesn't work.. :(
> I'm just started to learn vb, so i'm very newbie.. :(

> Thanks



Mon, 01 Aug 2005 07:52:36 GMT  
 Combo Box and Text Box - Plz Help

Quote:

> With the " Dim box1 as New textbox()"
> you create a new Textbox every Time the User changes the Combobox...........

> Draw a Text box in the Formular an simple say

> > Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As
> > System.Object, ByVal e As System.EventArgs) Handles
> > ComboBox1.SelectedIndexChanged
> >   Textbox1.text = combobox1.text
> > End Sub

> If your goal is realy to create new textboxes than
> you should give them all the same Position.

> If you want to create the Textbox dynamicly
> than put the go this way

> >   private box1 as New textbox()

> private sub Form_Load............
> >   box1 = new textbox()
> >   box1.name = "box1name"
> >   box1.localtion = new system.drawing.point(50,344)
> en sub

> > Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As
> > System.Object, ByVal e As System.EventArgs) Handles
> > ComboBox1.SelectedIndexChanged
> >   box1.text = combobox1.text
> > End Sub



> > When I select the item from combobox, I also want to update the text
> > in texbox.
> > So if I have a list of items(1,2,3) in combobox, when I select "1", it
> > should put "1" string in textbox. This works only one time.  So if I
> > change the selection to "2", my textbox text doesn't get change.  It
> > still show as "1"

> > Below is a part of my source code.

> > Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As
> > System.Object, ByVal e As System.EventArgs) Handles
> > ComboBox1.SelectedIndexChanged
> >   Dim box1 as New textbox()
> >   box1 = new textbox()
> >   box1.name = "box1name"
> >   box1.localtion = new system.drawing.point(50,344)
> >   box1.text = combobox1.text
> >   controls.add(box1)
> > End Sub

> > What am I doing wrong?
> > I also changed the texbox() to richtextbox(), still doesn't work.. :(
> > I'm just started to learn vb, so i'm very newbie.. :(

> > Thanks

This works!

Thanks!



Mon, 01 Aug 2005 23:29:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Limiting Access to Text Boxes, List Boxes and Combo Boxes

2. HELP Forms, combo boxes, text boxes

3. **Help Keep focus of a text box while chosing font from combo box

4. Help filling second combo box from fist combo box

5. Help filling second combo box from first combo box

6. Unable to populate text box from combo box

7. Putting a value from a combo box into a text box on a form

8. Filling combo box text box area from data

9. Created Form in Word - Irregular movement of combo boxes, text boxes on scrolling

10. Adding to a combo box or text box through the keyboard

11. Combo Boxes and Text Boxes

12. Combo Box and hidden text boxes upon choice

 

 
Powered by phpBB® Forum Software