We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Combo Box Problem...

Hi I have a combo on a windows form in a vb.net's windows application. I popoulated combo(cboClassList) as follows: ("getallsectiondetails" is sqlserver stored proc that provides all info to display in the combo box) Sub Fill_Classes() Dim objCon As SqlConnection Dim sectionDataAdapter As SqlDataAdapter Dim dsSection As New DataSet() Dim strQueryForSection As String Dim shiftinfoDataAdapter As SqlDataAdapter Dim dsShiftinfo As New DataSet() Dim strQueryForShiftinfo As String Dim batchDataAdapter As SqlDataAdapter Dim dsbatch As New DataSet() Dim strQueryForbatch As String Dim programDataAdapter As SqlDataAdapter Dim dsProgram As New DataSet() Dim strQueryForprogram As String Dim intCtrVar As Integer Dim TempItem As String objCon = New SqlConnection(Constr) cboClassList.Items.Clear() objCon.Open() strQueryForSection = "getallsectiondetails" sectionDataAdapter = New SqlDataAdapter(strQueryForSection, objCon) dsSection.Clear() sectionDataAdapter.Fill(dsSection, "section") For intCtrVar = 0 To dsSection.Tables("section").Rows.Count - 1 strQueryForShiftinfo = "getallsectiondetails" shiftinfoDataAdapter = New SqlDataAdapter(strQueryForShiftinfo, objCon) dsShiftinfo.Clear() shiftinfoDataAdapter.Fill(dsShiftinfo, "shiftinfo") strQueryForbatch = "getallsectiondetails" batchDataAdapter = New SqlDataAdapter(strQueryForSection, objCon) dsbatch.Clear() batchDataAdapter.Fill(dsbatch, "batch") strQueryForprogram = "getallsectiondetails" programDataAdapter = New SqlDataAdapter(strQueryForSection, objCon) dsProgram.Clear() programDataAdapter.Fill(dsProgram, "program") TempItem = dsProgram.Tables("program").Rows(intCtrVar).Item("degname") & " - " & dsbatch.Tables("batch").Rows(intCtrVar).Item("batchname") & " - " & dsShiftinfo.Tables("shiftinfo").Rows(intCtrVar).Item("shiftname") & " - " & dsSection.Tables("section").Rows(intCtrVar).Item("sectionname") cboClassList.Items.Add(TempItem) cboClassList.DisplayMember = TempItem cboClassList.ValueMember = dsSection.Tables("section").Rows(intCtrVar).Item("sectionid") Next cboClassList.SelectedIndex = 0 End Sub Now i want to get "sectionid" from currently selected item? How is it possible? Any help.......

Loader.
Live Chat Icon For mobile
Up arrow icon