Vb net 2010 display combobox selecteditem
'convert the SelectedItem into our custom myDataClass and 'When the SelectedIndexChanged event of the ComboBox fires we Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged 'array of our custom myDataClass and add them to a ComboBoxĬ(Array.ConvertAll(DS.Tables(0).Rows.Cast(Of DataRow).ToArray, Function(x As DataRow) New myDataClass(x))) 'Here we convert the rows of the table in the DataSet into an Using daEmployees As New SqlDataAdapter("Select * From Employees", sqlConn) Using sqlConn As New SqlConnection("Data Source=IANVAIO\SQLEXPRESS Initial Catalog=NORTHWIND Integrated Security=True") 'Here we define the database objects and read our Data into a DataSet Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
![vb net 2010 display combobox selecteditem vb net 2010 display combobox selecteditem](https://i.ytimg.com/vi/9lV6ANEhLyE/hqdefault.jpg)
Public Overrides Function ToString() As String 'Here we override what is displayed by the ToString method Str6_25PSI = IIf(Not myDataRow.IsNull(2), myDataRow(2).ToString, String.Empty).ToString Str0_5PSI = IIf(Not myDataRow.IsNull(0), myDataRow(0).ToString, String.Empty).ToString StrSize = IIf(Not myDataRow.IsNull(1), myDataRow(1).ToString, String.Empty).ToString Public Sub New(ByVal myDataRow As DataRow) 'DataRow into the appropriate class properties 'This is the constructor to convert the contents of the 'Here we create a new custom class that will hold each record from the If Not IsDBNull(t1.Rows(i).Item( "0_5PSI" )) ThenĮlseIf Not IsDBNull(t1.Rows(i).Item( "6_25PSI" )) Then If ComboBoxInletPressure.SelectedIndex = 0 ThenĮlseIf t1.Rows(i).Item( "Size" ) = ComboBox4.Text Then OleDbCommand (query, cnn)ĭim da As New OleDb. OleDbConnection (MDBConnString_)ĭim cmd As New OleDb.
![vb net 2010 display combobox selecteditem vb net 2010 display combobox selecteditem](https://www.codeproject.com/KB/combobox/ownerdrawncombobox/OwnerDrawnComboBox.gif)
Would you mind suggest me where should I correct in this code.ĭim query As String = "SELECT * FROM " & Table_ĭim MDBConnString_ As String = dataBaseLocationĭim cnn As OleDb.
#Vb net 2010 display combobox selecteditem code#
I was wondering what code should I write to pick the right part from database table according to user's pick from combobox. I have a combobox where I have two choices and for those two choices I have data stored in two different fields in the same access database table.