D
Don
I'm getting a strange error from the following code:
With Me.Combobox
' Clear list
.Items.Clear()
' Add items to the list
.Items.Add("item1")
.Items.Add("item2")
.Items.Add("item3")
' Select the default item
.SelectedItem = "item3" ' <--- This causes an exception
End With
The exception raised when trying to set the SelectedItem property of the
combox is:
Cast from string "item3" to type 'Integer' is not valid
I'm 100% sure this code used to work. I hadn't touched that project for
about a month, then I came back to it to fix up some code so that it would
compile with Option Strict on, but this code wasn't touched. I turned
Option Strict back off and it still craps out. The error message itself
doesn't make anysense because the SelectedItem property takes an Object, not
an integer, and the entire list is populated with strings, not integer.
What gives?
- Don
With Me.Combobox
' Clear list
.Items.Clear()
' Add items to the list
.Items.Add("item1")
.Items.Add("item2")
.Items.Add("item3")
' Select the default item
.SelectedItem = "item3" ' <--- This causes an exception
End With
The exception raised when trying to set the SelectedItem property of the
combox is:
Cast from string "item3" to type 'Integer' is not valid
I'm 100% sure this code used to work. I hadn't touched that project for
about a month, then I came back to it to fix up some code so that it would
compile with Option Strict on, but this code wasn't touched. I turned
Option Strict back off and it still craps out. The error message itself
doesn't make anysense because the SelectedItem property takes an Object, not
an integer, and the entire list is populated with strings, not integer.
What gives?
- Don