Beijer Electronics (formerly QSI Corporation)

DropDownListv2 String to Integer?
Page 1 of 1

Author:  UnknownBytes [ Fri Jan 31, 2014 7:33 am ]
Post subject:  DropDownListv2 String to Integer?

I'm trying to get an Integer value from the DropDownListv2 and I can't seem to get it.

Using val as follows:
dim spot_convert as integer

I've tried using the val function, but I get an error "Val: Illegal value given by string". Both the methods I showed above give me the error. If I look at the value of curSelText in the debugger it is given as 2,6,1 (for example). So it's getting the proper value, but still getting the error when using val.

I'd appreciate any help.

Author:  Jeremy [ Tue Feb 04, 2014 10:38 pm ]
Post subject:  Re: DropDownListv2 String to Integer?

If your drop down list is currently displaying the string value "2,4,1", then I would expect that converting that to an integer would fail as "2,4,1" is not a valid representation of an integer as a string. What value would you expect that string to produce?

Val can be used to convert strings to integers, but the string needs to look pretty much like you might type the number. For example "45" or "1932".

Perhaps it would help if you showed some more context about what values your drop list has and what numbers you want to get from the listbox for them.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group