Page 1 of 1
Dealing with select boxes
Posted: Wed Aug 05, 2009 4:55 pm
by mmurdock
I'm trying to do something like this in a form
varTest = cboAbsenceCode.SelectedKey
I get the following error:
Conversion from type 'Byte()' to type 'String' is not valid.
How do I handle this?
Thanks,
Mat
Dealing with select boxes
Posted: Wed Aug 05, 2009 6:39 pm
by Edward
Hi Mat,
Please open attached report in the Demo.exe sample application.
Thank you.
Dealing with select boxes
Posted: Thu Aug 06, 2009 12:19 am
by mmurdock
Thank you for that, but I would like to know the combo box's selected key. I seem to be able to get this if the key is a string, but if the key is an integer then I seem to have a problem.
Mat
Dealing with select boxes
Posted: Thu Aug 06, 2009 1:36 am
by Jan
Hello,
You can use following expression:
Code: Select all
ComboBoxControl1.Control.SelectedKey
Thank you.
Dealing with select boxes
Posted: Thu Aug 06, 2009 10:23 am
by mmurdock
if I try this:
Code: Select all
varTest = cboAbsenceCode.Control.SelectedKey
I get this error: "error BC30456: 'SelectedKey' is not a member of 'System.Windows.Forms.ComboBox'."
If I try this:
Code: Select all
varTest = cboAbsenceCode.SelectedKey
I get this error:
Conversion from type 'Byte()' to type 'String' is not valid.
I need the key value.
Thanks,
Mat
Dealing with select boxes
Posted: Thu Aug 06, 2009 2:31 pm
by Jan
Hello,
Sorry corrected expression is:
Code: Select all
varTest = cboAbsenceCode.Control.SelectedItem
Thank you.
Dealing with select boxes
Posted: Fri Aug 07, 2009 4:13 pm
by mmurdock
I know how to get the selected item. I need the selected key!!!!
Mat
Dealing with select boxes
Posted: Tue Aug 11, 2009 10:47 am
by johnham
mmurdock wrote:I'm trying to do something like this in a form
varTest = cboAbsenceCode.SelectedKey
I get the following error:
Conversion from type 'Byte()' to type 'String' is not valid.
How do I handle this?
Thanks,
Mat
It would seem that this works for you except for a type conversion problem. Have you tried the following? Just my two sense... I haven't really checked it out.
Code: Select all
varTest = cboAbsenceCode.SelectedKey.ToString()