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.
Unfortunately, activation email could not send to your email. Please try again.

Combo Box Problem...

Thread ID:




6528 Aug 15,2003 04:00 AM Windows Forms 0
Tags: FAQ
Asked On August 15, 2003 04:00 AM

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.......


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.