jaspalsinghkhokhar
Member
- Joined
- Sep 1, 2009
- Messages
- 6
- Programming Experience
- 5-10
VB.NET:
the combo box is populated as follows
VB.NET:
Dim strSQL As String = "SELECT ageYear, ageBand from tblMobAgeBands WHERE firstGroup = 1 ORDER BY tableID"
Dim objConnection As New SqlCeConnection(My.Resources.myConnection)
Dim dsRenewalBands1 As New DataSet
Dim objAdaptor As New SqlCeDataAdapter(strSQL, objConnection)
Dim dtAgeBands1 As New DataTable
Dim drDSRow As DataRow
Dim drNewRow As DataRow
Try
objAdaptor.Fill(dsRenewalBands1, "dtAgeBands1")
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
dtAgeBands1.Columns.Add("id", GetType(System.Int32))
dtAgeBands1.Columns.Add("band", GetType(System.String))
'now populate with renewal bands
For Each drDSRow In dsRenewalBands1.Tables("dtAgeBands1").Rows()
drNewRow = dtAgeBands1.NewRow()
drNewRow("id") = drDSRow("ageYear")
drNewRow("band") = drDSRow("ageBand")
dtAgeBands1.Rows.Add(drNewRow)
Next
With Me.cboAge1to20
.DataSource = dtAgeBands1
.DisplayMember = "band"
.ValueMember = "id"
End With
Me.cboAge1to20.DropDownStyle = ComboBoxStyle.DropDownList
this populates the combo box fine
however when i try to access the valuemember like
VB.NET:
Me.txtAgeYear.Text = Me.cboAge1to20.ValueMember
the text box is populated with id rather than the value
can anyone help?