Results 1 to 3 of 3

Thread: Range of data selection for specific Item in VB6 under a ComboBox

  1. #1

    Thread Starter
    Member
    Join Date
    May 2009
    Posts
    50

    Exclamation Range of data selection for specific Item in VB6 under a ComboBox

    Dear Sir

    I am trying to select range of data for a particular item in VB6. That is, I have two ComboBox. One is storing Item & another Item code.

    I want to display 100 to 199 in Combo2 when I shall select Item "Computer" in Combo1 and will display Item code 200 to 299 in Combo2 for "Monitor" when I will select from Combo1. At that time, previous Item code 100 to 199 for Item "Computer" will not be in Combo2. I have used below code but not working. Please help.

    CODE:
    Private Sub combo1_Click()
    Dim a, b As Integer
    If combo1.Text = "Computer" Then
    For a = 100 To 199 Step 1
    combo2.AddItem (a)
    Next a
    combo2.text=""
    ElseIf combo1.Text = "Monitor" Then
    For b = 200 To 299 Step 1
    combo2.AddItem (b)
    Next b
    combo2.text=""
    End If
    End Sub

    Regards
    Pervez

  2. #2
    Hyperactive Member jp26198926's Avatar
    Join Date
    Sep 2008
    Location
    General Santos City, Philippines
    Posts
    310

    Re: Range of data selection for specific Item in VB6 under a ComboBox

    Code:
    Private Sub combo1_Click()
    Dim a, b As Integer
    
    Combo2.Clear
    
    If Combo1.Text = "Computer" Then
        For a = 100 To 199 Step 1
            Combo2.AddItem (a)
        Next a
    ElseIf Combo1.Text = "Monitor" Then
        For b = 200 To 299 Step 1
            Combo2.AddItem (b)
        Next b
    End If
    
    End Sub
    "More Heads are Better than One"

  3. #3

    Thread Starter
    Member
    Join Date
    May 2009
    Posts
    50

    Resolved Re: Range of data selection for specific Item in VB6 under a ComboBox

    Dear Sir

    Thanks a lot. It's working.

    Regards
    Pervez

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