Hi,
I'm using multi-column comboboxes (with 2 columns). That works using Datasource, but problem is that combobox raises Selectedindex & Texchanged event like this.
Adding items doesn't raise those events, which I want. I can add items using ExecuteReader, but only If query returns 1 value (in my case 2 fields). Here is my code - this is binding method and It works:
Code:
Dim Combo As ComboBox = DirectCast(sender, ComboBox)
Dim dtb As New DataTable()
Try
Using cmd As New OracleCommand("Lucky.Employees", MyConn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New OracleParameter("Person", OracleDbType.RefCursor)).Direction = ParameterDirection.Output
Using dad As New OracleDataAdapter()
dad.SelectCommand = cmd
dad.Fill(dtb)
End Using
Combo.DisplayMember = "NAME"
Combo.DataSource = dtb
End Using
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Combo.SelectedIndex = -1
I tried replacing databinding for adding items with ExecuteReader like this, but nothing get's added:
Code:
Dim dr As OracleDataReader = cmd.ExecuteReader()
While dr.Read
Combo.Items.Add(dr.GetString(0))
End While
Does somebody know how I could ADD both columns ?