Sheritlw
asked on
Get Selected Index from ComboBox
Hi EE,
I am trying to get the selected id for a combobox.
I have tried ... cC.StateID = Me.cboState.ValueMember(Me .cboState. SelectedIn dex) but it is an error.
What I need is the value that is saved in there from the code below.
Thanks
I am trying to get the selected id for a combobox.
I have tried ... cC.StateID = Me.cboState.ValueMember(Me
What I need is the value that is saved in there from the code below.
Thanks
Dim ds As New DataSet
If DatabaseToUse() = BizObjs.DBType.Access Then
'Access Database
Dim cFields As New cFieldTableNames
cFields.ComboTable = msTblName
SelectStr = cFields.ReturnComboString()
Dim dc As New OleDb.OleDbConnection(ConnectionString)
Dim da As New OleDb.OleDbDataAdapter(mSelectStr, dc)
Try
da.Fill(ds)
dc.Close()
cnt.DataSource = ds.Tables(0)
cnt.DisplayMember = cFields.SendToCorrectFieldProcedure(3)
cnt.ValueMember = cFields.SendToCorrectFieldProcedure(1)
'Returns the field Name of "StateID"
Catch ex As Exception
MessageBox.Show(ex.Message)
Throw ex
Finally
dc.Close()
da.Dispose()
End Try
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is just a matter of time and you get use to it. You will love in the end :)
ASKER
No I didn't try... I guess that just seemed so simple.
I know after many years programming in VB 5 - VB 6, .Net seems like it requires a lot of code.
I always used sql server as a backend, until now and the backend handled everything.
In .Net it seems like you have to write a lot of code in the front end, no matter what.
Thanks,
Sheri