Question:

How can i get the list in combo box by just typing some intial letters in vb 6.0 ?

by  |  earlier

0 LIKES UnLike

for eg to get the list of city with the inital P than i just have to press P & i get all the list of city with initial Ps ..........in combo box not list box with vb6.0 application

 Tags:

   Report

1 ANSWERS


  1. this is the code you must be needing

    the variable that are not declared localy need to be declared in the module it self

    this will work like a cellphone list

    the list can be in the mdb format which is accessed through the adodb activex control

    Private Sub combo1_KeyPress(KeyAscii As Integer)

    ka3 = KeyAscii

    End Sub

    Private Sub combo1_KeyUp(KeyCode As Integer, Shift As Integer)

    Dim ac, AP As String

    Dim jj As Single

    If ka3 = 8 Then

    comb3 = ""

    Combo1.Text = ""

    Combo1.Clear

    Text1.Text = ""

    GoTo coend:

    If KeyCode < 8 Or (KeyCode > 8 And KeyCode < 32) Then GoTo coend:

    If ka3 = 8 Then

    If jj > 0 Then jj = jj - 1

    GoTo comid:

    End If

    jj = jj + 1

    comb3 = comb3 + Chr(ka3)

    'Label3.Caption = comb3

    comid:

    Dim ii As Single

    ins.Open "Select distinct(name),sno,csno from customer where sno like '" & comb3 & "%'", con

    Combo1.Clear

    If ins.EOF = False Then

    Combo1.Text = ins.Fields(1)

    tic.Open "select name from customer where csno = " & Val(ins.Fields(2)), con

    Do While tic.EOF = False

       Combo1.AddItem (tic.Fields(0))

         tic.MoveNext

    Loop

    tic.Close

       If Len(Combo1.Text) = 50 Then

       colen3 = 51

       End If

    GoTo coendc:

    Else

        'If combo1.Text <= bno Then

        MsgBox "correct Customer No only"

        comb3 = ""

        Combo1.Text = ""

        'End If

    End If

    coendc:

    ins.Close

    coend:

    End sub

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.