VB.NET: Extract numbers from Listbox

toytoy

Well-known member
Joined
Jul 16, 2004
Messages
46
Programming Experience
1-3
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..

Thanks
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
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)
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
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.
 
Top Bottom