Results 1 to 10 of 10

Thread: Display textbox using combobox

  1. #1

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Display textbox using combobox

    Hi

    how to select the required items in multiple comboboxes to
    display individually into multiple textboxes / Label......

    Example: Combo item 1 from combobox to display into textbox1
    Combo item 2 from combobox2 to display into textbox2


    Multiple tasks..

    Thanks

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    TextBox1.Text = ComboBox1.SelectedItem.ToString

    Is that what you mean? Not quite clear, though.

  3. #3

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230
    Hi

    Still cannot...

    I want to select the combo items and display into another form
    I may select more than one combo boxes...

    This is the error:

    An unhandled exception of type 'System.NullReferenceException' occurred

    Thanks

  4. #4

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230
    This is part of my code:
    Code:
        Private Sub btnAddAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddAdd.Click
          
            Dim lblSubCategory, lblRepeat
            Dim confirm As New Confirm
    
            If cboSubCategory.Text <> "" And cboRepeat.Text <> "" Then
                lblSubCategory.text = cboSubCategory.SelectedItem.ToString
                lblRepeat.Text = cboRepeat.SelectedItem.ToString
                confirm.Show()
                Me.Hide()
            Else
                MessageBox.Show("Please fill the area", "Missing data", _
                MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            End If
    Last edited by toytoy; Dec 3rd, 2004 at 08:23 AM.

  5. #5

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Red face

    I solve it just because i forgot to put a dot in front the lblSubCategory and lblRepeat....


  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    You may pound your head against a brick wall now.

  7. #7

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Cool

    Hi

    Is there a way to make sure that some combo box is a required field to key in and some not....

    At the same time, it can be send to display into the textbox..

    Thanks

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by toytoy
    Hi

    Is there a way to make sure that some combo box is a required field to key in and some not....
    THe combobox has a Tag property, you can store information about the combobox in there, and check it during your validation procedure.

  9. #9

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230
    Hi

    What you mean by store information...

    information is already inside the collection property....
    or you means put the combo box name inside the tag...

    actually how is this tag really work... i really blur..

    Thanks

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    You said that you want to know whether the ComboBox is a required field or not. What you could do is set it's .Tag() property to "Required".

    The Tag property can hold any object, I'd generally use it to hold a string with info about that particular field.

    Later, when you are validating the inputs in the form, you can run through and check it's Tag() property to see if it's "Required" and then work accordingly.

    I'm only giving you a rough idea, because you have a rough question, but it should do well enough.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width