N
NewsGroup de Microsoft
how can i bind by coding with valueMember, displayMember and datasource
properties.
if i do it visually, that's right but if i code it, not.
i do somethin' like that:
Dim gCadenaConexion As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source= " & ObtenRutaAplicacion() & "Datos\Datos.mdb"
Dim conexion As New OleDb.OleDbConnection(gCadenaConexion)
Dim adapter As New OleDb.OleDbDataAdapter("SELECT idPublicoObjetivo,
Descripcion FROM PublicoObjetivo", conexion)
Dim dataset As New DataSet()
conexion.Open()
adapter.Fill(dataset, "tabla")
conexion.Close()
Me.ComboBox1.DataSource = dataset
Me.ComboBox1.DisplayMember = "Descripcion"
Me.ComboBox1.ValueMember = "idPublicoObjetivo"
properties.
if i do it visually, that's right but if i code it, not.
i do somethin' like that:
Dim gCadenaConexion As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source= " & ObtenRutaAplicacion() & "Datos\Datos.mdb"
Dim conexion As New OleDb.OleDbConnection(gCadenaConexion)
Dim adapter As New OleDb.OleDbDataAdapter("SELECT idPublicoObjetivo,
Descripcion FROM PublicoObjetivo", conexion)
Dim dataset As New DataSet()
conexion.Open()
adapter.Fill(dataset, "tabla")
conexion.Close()
Me.ComboBox1.DataSource = dataset
Me.ComboBox1.DisplayMember = "Descripcion"
Me.ComboBox1.ValueMember = "idPublicoObjetivo"