Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Posts
    15

    Unanswered: display text field when select item in combo box

    hi,
    i am beginner user of vb. i create one combo box with this items:-
    1. change component
    2. change ic
    3. align component
    when i select the (2) item - change ic, the form will show 2 text fields to me
    1. ic part no.
    2. new lot code
    (temporary i enabled the 2 text fields before i select the (2) item - change ic)
    so, can you help me show how to write the full coding.
    thank you.

  2. #2
    Join Date
    Aug 2004
    Posts
    15

    detect every station pc no. in network

    hi,
    using vb, if there a way i can detect every station pc no. in network when i go to login page then display another form, vb can detect the station no. and show it at the form header?

    thank you.

  3. #3
    Join Date
    Jul 2004
    Posts
    69
    Quote Originally Posted by azifa7980
    hi,
    i am beginner user of vb. i create one combo box with this items:-
    1. change component
    2. change ic
    3. align component
    when i select the (2) item - change ic, the form will show 2 text fields to me
    1. ic part no.
    2. new lot code
    (temporary i enabled the 2 text fields before i select the (2) item - change ic)
    so, can you help me show how to write the full coding.
    thank you.
    is it you disabled the 2 text fields or just hide it? if you just disabled it then just enabled it (look at my sample) and if it was invisible, make it visible by changing the visible property to True.

    Private Sub cmbItems_Click()
    If cmbItems.ListIndex = 1 Then 'index starts at 0 so the 2nd item will be 1
    txtIC_Part_No.Enabled = True
    txtNew_Lot_Code.Enabled = True
    End If
    End Sub

    Hope this is what you meant.

  4. #4
    Join Date
    Jul 2004
    Posts
    69
    Quote Originally Posted by azifa7980
    hi,
    i am beginner user of vb. i create one combo box with this items:-
    1. change component
    2. change ic
    3. align component
    when i select the (2) item - change ic, the form will show 2 text fields to me
    1. ic part no.
    2. new lot code
    (temporary i enabled the 2 text fields before i select the (2) item - change ic)
    so, can you help me show how to write the full coding.
    thank you.
    is it you disabled the 2 text fields or just hide it? if you just disabled it then just enabled it (look at my sample) and if it was invisible, make it visible by changing the visible property to True.

    Private Sub cmbItems_Click()
    If cmbItems.ListIndex = 1 Then 'index starts at 0 so the 2nd item will be 1
    txtIC_Part_No.Enabled = True
    txtNew_Lot_Code.Enabled = True
    End If
    End Sub

    Hope i did help you.

  5. #5
    Join Date
    Aug 2004
    Posts
    15

    an error!!

    i have tried what are you suggested to me. but i found an error here.

    A Compile Error:
    Method or data member not found.

    what i suppose to do now? please help me!

  6. #6
    Join Date
    Jul 2004
    Posts
    69
    huh? well, here's a sample for you. (dont know how come it was an error!)

    Private Sub Combo1_Click()
    If Combo1.ListIndex = 1 Then
    Text1.Enabled = True
    Text2.Enabled = True
    Else
    Text1.Enabled = False
    Text2.Enabled = False
    End If
    End Sub

    Private Sub Form_Load()
    Text1.Enabled = False
    Text2.Enabled = False
    With Combo1
    .AddItem "Change Component"
    .AddItem "Change IC"
    End With
    End Sub

    First, ive created a combobox (Combo1) then 2 textboxes (Text1 & Text2)

    Then in the Form_Load event, i add 2 items in the combobox, the "Change Component" and "Change IC" and set the 2 textboxes in disabled mode.

    In the Combo1_Click event, since you decided that if we select the 2nd choice or item, which is Change IC, (ive explained why i use ListIndex =1 in my previous post) then enabled the 2 textboxes, otherwise, if the user select the first item, then it'll be disabled again.

    Hope this will help u.

Posting Permissions

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