[dba-VB] VB.Net combo

John Colby jwcolby at ColbyConsulting.com
Wed Jan 11 08:09:08 CST 2006


We're making progress here.  The code now is:

    Function LoadCboService()
        Dim strCnn As String = My.Settings.C2DbConquestConnectionString
        Dim cnn As New SqlConnection(strCnn)
        cnn.Open()
        Dim strSQLService As String = "SELECT * FROM tlkpService"
        Dim cmd As New SqlCommand(strSQLService, cnn)
        Dim adpt As New SqlDataAdapter(cmd)

        Dim Ds As DataSet
        Ds = New DataSet("cboService")
        adpt.Fill(Ds, "cboService")
        cboService.DataSource = Ds.Tables("cboService").DefaultView
        cboService.DisplayMember = "SVC_Service"
        cboService.ValueMember = "SVC_ID"
        Return True
    End Function 


The combo displays the PK field however, not the Rank string.  SVC_ID is the
PK, so the value member is being displayed

John W. Colby
www.ColbyConsulting.com 


-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Mike & Doris
Manning
Sent: Wednesday, January 11, 2006 8:21 AM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] VB.Net combo

Don't ask where my brain was when we talked about this yesterday.  It was
obviously way too tired to think straight...

The reference to the dataset is already known from the Datasource so all you
need to do is directly tie the properties to the fields like this...

cboService.DisplayMember = "RA_Rank"
cboService.ValueMember = "RA_ID"

Doris Manning
mikedorism at verizon.net



_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list