Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21090

Show combobox partial value in label2

$
0
0
Is it possible to display partial combobox1 value in label2?

I have below code to display two access field value in one combobox during startup.
Code:

Public Sub InitDatas()
On Error GoTo err:
    If rs.State = adStateOpen Then rs.Close
   
    rs.Open "Select * from tblEmp", cn, adOpenKeyset, adLockPessimistic
    Do While rs.EOF = False
        ComboBox2.AddItem rs.Fields("EM_ID").Value & " " & rs.Fields("NAME").Value
      ' ComboBox2.AddItem rs.Fields("EM_ID").Value
        rs.MoveNext
    Loop
    Exit Sub
err:
    MsgBox err.Description, vbCritical, "Error"
    Set rs = Nothing
End Sub

But When I select one value in combobox1 (it consist of 2 column), i need 1st or 2nd column to display in label2
so that I can create listview to display the list by filtering the label2 value.

Is there any way, When I did there was error that Null was not properly coded...

Please help me.

vb-kid

Viewing all articles
Browse latest Browse all 21090

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>