I am trying to convert a listbox to an array so i got this line
var modarray = listBox1.Items.Cast<String>().ToArray();
but then i also need to use an int array
so i tried the following
int[] arr = modarray.Cast<int>().ToArray();
but i get an error that suggests that is not possible to convert the array. Can anybody helpme please
xikhari.some1behindu
0
Newbie Poster
Recommended Answers
Jump to PostYou'll need to convert them one by one, you can't cast strings into int. So use Convert.ToInt32, Int32.Parse or Int32.TryParse
All 3 Replies
Momerath
1,327
Nearly a Senior Poster
Featured Poster
xikhari.some1behindu
0
Newbie Poster
Momerath
1,327
Nearly a Senior Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.