|
-
Oct 22nd, 2004, 03:14 AM
#1
Thread Starter
Addicted Member
VB.NET: Extract day, month or year from the Listbox..[Unresolved]
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
Last edited by toytoy; Jan 24th, 2005 at 01:24 AM.
-
Oct 22nd, 2004, 04:32 AM
#2
Hyperactive Member
If I understand correctly what you need, you have to use Split method (using "/"c as separator) on the selected item.
You will obtain a three elements string array that you can assign to your textbox as needed.
Hope, this helps.
Live long and prosper (Mr. Spock)
-
Oct 22nd, 2004, 05:23 AM
#3
Thread Starter
Addicted Member
but i have already use the separator on the dates before displaying in the listbox to get "10/2/2004" and "12/4/2004"..
how to use it again on the Selected Items...
I don't understand how to use again..
cboInfo.SelectedItem & "/" ?...
Could you show some examples..
And also that all the dates are display in one listbox only..
and after chosen all are display in 3 different textboxes..
Thanks
Last edited by toytoy; Oct 22nd, 2004 at 05:32 AM.
-
Oct 22nd, 2004, 07:05 AM
#4
Lively Member
You can use Month(), Day(), & Year() functions passing in the date in questions. This will extract the values you need.
Looking further there doesn't seem to be a Day() function, but I'm sure it's called something else. Look in to it.
-
Oct 22nd, 2004, 09:25 AM
#5
Hyperactive Member
Uhmmm....sorry dear friend Toytoy, now I'm sure I've not understand your problem. It often happens to me, because I should study english more seriously, but I've not sufficient time
I hope our friend RickP, gave you what you need. Good job!
Live long and prosper (Mr. Spock)
-
Oct 22nd, 2004, 09:50 AM
#6
Thread Starter
Addicted Member
Last edited by toytoy; Dec 3rd, 2004 at 07:54 AM.
-
Oct 22nd, 2004, 11:20 AM
#7
Lively Member

Did I at least point you in the right direction? That's usually my goal for every answer I give.
-
Oct 22nd, 2004, 11:32 AM
#8
Thread Starter
Addicted Member
anyway.....
thanks all of you for the suggestion.
-
Jan 24th, 2005, 01:23 AM
#9
Thread Starter
Addicted Member
Re: VB.NET: Extract day, month or year from the Listbox
Say i have these dates:
12-2-05......can
12-12-05....can
12-13-05....cannot
12-22-05....cannot
Refer to the above dates, why the below XML tag could not work well with days above "12"... when i send to server..
I could only send 1,2,3,4,5,....up to 12 only.
Code:
"<" & "Date" & " " & "day=" & """" & Convert.ToDateTime(lst.SelectedItem.ToString).Date.Day & """" & " "
& "month=" & """" & Convert.ToDateTime(lst.SelectedItem.ToString).Date.Month & """" & " " & "year=" & """"
& Convert.ToDateTime(lst.SelectedItem.ToString).Date.Year & """" & " >" & _
</" & "Date" & ">" & _
The error message is:
Code:
Additional information: String was not recognized as a valid DateTime.
Does anyone have better solution to solve it....
Thanks
Last edited by toytoy; Jan 24th, 2005 at 01:50 AM.
-
Jan 25th, 2005, 10:27 PM
#10
Thread Starter
Addicted Member
Re: VB.NET: Extract day, month or year from the Listbox..[Unresolved]
For the above problem....
I am not sure why if i use other set of computers with the same Visual Studio 2003, it works...
how to update all the classes so that my computer could also be use..
-
Jan 25th, 2005, 11:46 PM
#11
Thread Starter
Addicted Member
Re: VB.NET: Extract day, month or year from the Listbox..[Unresolved]
I find the problem is on the Format of the D/MM/YYYY...
After i change the date format, it could work...
Is there any way to format the date so that the program could works well in all computers without having to worry about whether the computer have set to the required date format.....
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|