Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could not get the Column property. ComboBox

Status
Not open for further replies.

andols

Programmer
Aug 30, 2005
12
SE
Hi,

I have a problem with a ComboBox, I fill the listbox with data (two cloumns, name and identifier) and the user shall choose one of the post in the Listbox.

But if the user print something else and press GO I wold like to be able to pick up that and exit the sub.

Some thing like this

CODE
If cboOrt.Column(2) Is Nothing Then
MsgBox "Någonting gick snett, orten hittades inte"
Exit Sub
End If
But when I come to that line I get

CODE
<Could not get the Column property. Invalid property array index.
I dont want to make the ComboBoxnote "writeable" because the user should be able to write and the listbox "MatchEntry".

Thanx
Anders Olsson
 
Hi Anders,

As far as I know the .Column property is zero based so your code would actually be looking for the third column.

I tried your code using the zero based index and still got errors so I changed it slightly. Does this do something like what you are wanting:
Code:
If cboOrt.Column(1) = "" Then
 MsgBox "Någonting gick snett, orten hittades inte"
 Exit Sub
 End If
Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Hi,

You are rigth, I have 3 columns in my comobox. I looks like this

Karlsro Karlskron 12312
Karlsro Olofström 34234
Karlstorp Karlshamn 9030
Karlstorp Karlskrona 12313
and so on

But when the user print somthing that not corespond to a line in the combobox I get the error below.

Code:
<Could not get the Column property. Invalid property array index.

//Anders
 
What code are you using now then?

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top