I have something that doesn't seem to work in vb 2010.
I have set up a combobox on a form. The user can select an item from the drop-down list. That part works.
I want to get the selection text into a variable so that it can be referenced globally. That does not seem to work. Maybe I am using the wrong variable type in the variable definition ( I thought String would cover it. ) .
The correct item can be seen and referred to as ComboBox.SelectedItem but this will not go into a variable. Why not ? Does anyone know ?
I have tried;
Dim this As String
this = Combobox1.SelectedItem
MsgBox(this)
but it comes up with nothing for 'this' although MsgBox(Combobox1.SelectedItem) will correctly display what it should be.
Question
Getwin
Hi to all
I have something that doesn't seem to work in vb 2010.
I have set up a combobox on a form. The user can select an item from the drop-down list. That part works.
I want to get the selection text into a variable so that it can be referenced globally. That does not seem to work. Maybe I am using the wrong variable type in the variable definition ( I thought String would cover it. ) .
The correct item can be seen and referred to as ComboBox.SelectedItem but this will not go into a variable. Why not ? Does anyone know ?
I have tried;
Dim this As String
this = Combobox1.SelectedItem
MsgBox(this)
but it comes up with nothing for 'this' although MsgBox(Combobox1.SelectedItem) will correctly display what it should be.
Does anyone know what I am doing wrong ?
Thanx
Link to comment
Share on other sites
6 answers to this question
Recommended Posts