Am I losing my mind ??
I tried this but it sends me error :
MsgBox(ComboBox4.SelectedItem)
any thoughts plz ?
Printable View
Am I losing my mind ??
I tried this but it sends me error :
MsgBox(ComboBox4.SelectedItem)
any thoughts plz ?
the error says :
Can't be converted to 'String' ?? I tried Ctype fun and ToString but with this stupid error ?
I've just tried this but gives empy msgbox :
MsgBox(ComboBox4.SelectedText.ToString)
or
MsgBox(ComboBox4.SelectedText)
What type is the objects you are putting in the ComboBox? What do you have set as the DisplayMember of the Combo?
I'm using this sub to load all tables in my db (your sub actually :D)Quote:
Originally posted by Edneeis
What type is the objects you are putting in the ComboBox? What do you have set as the DisplayMember of the Combo?
VB Code:
Public Shared Sub LoadTables(ByVal Combox As ComboBox) Dim var As New Variables() var.MyConnection.Open() Dim Tables As DataTable = var.MyConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"}) var.MyConnection.Close() Combox.DataSource = Tables Combox.DisplayMember = "TABLE_NAME" End Sub
and this line in the form_load .
VB Code:
ComboBox4.DropDownStyle = ComboBoxStyle.DropDownList
That is wierd must be some kind of conversation problem. Try just using Combox.Text, since if the item is selected the it is the same as what selectedtext should be.
lol :D . It's working now Edneeis ! thank you so much .
I've tried everything except this .
Weird .. I can get selected items in other comboxes .I think if it is bounded , then it needs more code or whatever .But can you guess what's going wrong ??
No I'm not sure what the trouble is. I know even bound, you can usually get the SelectedText, but something about binding to a datatable directly or at least this one makes it not work.
Actually I thought I've used it before with a bound combo, but maybe not because it did the same thing when bound to an array of strings.
It's a bug maybe .Thanx anyways for the help ! :)