VB.NET: Extract numbers from Listbox


Well-known member
Jul 16, 2004
Programming Experience
Say I have these dates in the listbox...

First Date: 10/2/2004
Second Date: 12/4/2004

but how to extract the "2" from the first date into the textbox..

Since i need to display all the dates and from there the user will choose from any of the dates..

lastly, the choosen day, month and year will be separately display into 3 textboxes...

Is there any way to solve it or i should not use the listbox to do it...

any suggestion..

they have to select the item from the listbox for this to work (so putting this into the listbox's selectedindexchanged event would make sense)

dim strSelectedDate as String

strSelectedDate = listbox1.text

now all ya gotta do is get it get the "2" out of the variable (i'll leave that to you to figure out)
I'm not sure at all what you're trying to do but, ...

If you can get the date into a Date structure (one way: create a Date variable and set it equal to a string like "10/2/2004"), you can use the Day, Month, and Year properties of the date structure.