lunaclover
Programmer
- Jun 22, 2005
- 54
Hi everybody -
I am just trying to do something simple and can't find the right way to do it.
I have a listbox whose content changes depending on selections a user has made previously. I then use this selection to produce part of a model number. Sometimes the things in the listbox are strings, sometimes they are doubles. But if you have a selection made in the listbox, and you go back and change another selection you have made somewhere else, it will give you a:
[error]
An unhandled exception of type 'System.InvalidCastException' occurred in system.dll
Additional information: Cast from string "20 KW" to type 'Double' is not valid.
[/error]
So now I'm trying to make a code that if these certain items are changed after a selection in the listbox has been made, then unselect that item. Hopefully that will stop it from breaking.
I have tried
Sorry I am really not very experienced, how do I acheive what I am trying to do? Which property should I use? I wish there was a deselect or unselect property on this control.
Thanks for any help anyone can provide!
~Luna
I am just trying to do something simple and can't find the right way to do it.
I have a listbox whose content changes depending on selections a user has made previously. I then use this selection to produce part of a model number. Sometimes the things in the listbox are strings, sometimes they are doubles. But if you have a selection made in the listbox, and you go back and change another selection you have made somewhere else, it will give you a:
[error]
An unhandled exception of type 'System.InvalidCastException' occurred in system.dll
Additional information: Cast from string "20 KW" to type 'Double' is not valid.
[/error]
So now I'm trying to make a code that if these certain items are changed after a selection in the listbox has been made, then unselect that item. Hopefully that will stop it from breaking.
I have tried
Code:
listbox.selecteditem = ""
Code:
listbox.selecteditem = nothing
Code:
listbox.selectedvalue = nothing
Code:
listbox.selecteditem = false
Sorry I am really not very experienced, how do I acheive what I am trying to do? Which property should I use? I wish there was a deselect or unselect property on this control.
Thanks for any help anyone can provide!
~Luna