Dealing with select boxes

Stimulsoft Reports.NET discussion
Post Reply
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Dealing with select boxes

Post 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
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Dealing with select boxes

Post by Edward »

Hi Mat,

Please open attached report in the Demo.exe sample application.

Thank you.
Attachments
203.ComboboxMasterAndDetail.mrt
(16.69 KiB) Downloaded 244 times
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Dealing with select boxes

Post 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
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Dealing with select boxes

Post by Jan »

Hello,

You can use following expression:

Code: Select all

ComboBoxControl1.Control.SelectedKey
Thank you.
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Dealing with select boxes

Post 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
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Dealing with select boxes

Post by Jan »

Hello,

Sorry corrected expression is:

Code: Select all

varTest = cboAbsenceCode.Control.SelectedItem
Thank you.
mmurdock
Posts: 94
Joined: Tue Mar 20, 2007 4:59 pm

Dealing with select boxes

Post by mmurdock »

I know how to get the selected item. I need the selected key!!!!

Mat
johnham
Posts: 98
Joined: Fri Sep 19, 2008 2:27 pm
Location: Richland, WA, USA

Dealing with select boxes

Post 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()

Thanks,
John Hamilton
Hamilton & Company, LLC
Post Reply