|
-
Mar 3rd, 2003, 02:23 AM
#1
Thread Starter
Sleep mode
Get Selected item in combox ??[Resolved]
Am I losing my mind ??
I tried this but it sends me error :
MsgBox(ComboBox4.SelectedItem)
any thoughts plz ?
Last edited by Pirate; Mar 3rd, 2003 at 03:14 AM.
-
Mar 3rd, 2003, 02:28 AM
#2
Thread Starter
Sleep mode
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)
-
Mar 3rd, 2003, 02:42 AM
#3
What type is the objects you are putting in the ComboBox? What do you have set as the DisplayMember of the Combo?
-
Mar 3rd, 2003, 02:43 AM
#4
Thread Starter
Sleep mode
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?
I'm using this sub to load all tables in my db (your sub actually )
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
-
Mar 3rd, 2003, 02:46 AM
#5
Thread Starter
Sleep mode
and this line in the form_load .
VB Code:
ComboBox4.DropDownStyle = ComboBoxStyle.DropDownList
-
Mar 3rd, 2003, 02:56 AM
#6
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.
-
Mar 3rd, 2003, 02:58 AM
#7
Thread Starter
Sleep mode
lol . It's working now Edneeis ! thank you so much .
I've tried everything except this .
-
Mar 3rd, 2003, 03:00 AM
#8
Thread Starter
Sleep mode
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 ??
-
Mar 3rd, 2003, 03:10 AM
#9
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.
-
Mar 3rd, 2003, 03:13 AM
#10
Thread Starter
Sleep mode
It's a bug maybe .Thanx anyways for the help !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|