DateTimePicker question in vb.net
Page 1 of 113 Replies - 1270 Views - Last Post: 05 March 2012 - 02:38 AM
#1
DateTimePicker question in vb.net
Posted 05 March 2012 - 12:26 AM
hi im a beginner in vb.net and im just wondering if DateTimePicker can be edited if you play it for example it is on the current date today march 5,2012 and i am trying to go way back to 1990 for birthdate for example, what im trying to say is make it easy to use not taking time to clicking it on the year 1990, i am currently using vb.net 2008 and mysql express for my db
Replies To: DateTimePicker question in vb.net
#2
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 12:48 AM
you mean by code? something like this?
Dim dt As New DateTime(1990, 3, 5)
DateTimePicker1.Text = dt.ToString
#3
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 12:51 AM
#4
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 01:05 AM
it's not very clear to me what you want to do. But if want to set default year for date time picker without clicking than you can use this code
or
Dim dt As New DateTime(Year as integer, Month as integer, Day as integer) DateTimePicker1.Text = dt.ToString
or
Dim dt As New DateTime(Year as integer, Month as integer, Day as integer) DateTimePicker1.Value = dt
#5
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 01:19 AM
I think I get it - you type a month, date and year and it will select accordingly. This is a quick solution that has no error handling but,
Dim d As String = InputBox("Enter date")
Dim m As String = InputBox("Enter month")
Dim y As String = InputBox("Enter Year")
Dim dt As DateTme = New DateTime(Integer.Parse(y), Integer.Parse(m), Integer.Parse(d))
DateTimePicker1.Value = dt
#6
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 01:26 AM
sela007, on 05 March 2012 - 01:05 AM, said:
it's not very clear to me what you want to do. But if want to set default year for date time picker without clicking than you can use this code
or
Dim dt As New DateTime(Year as integer, Month as integer, Day as integer) DateTimePicker1.Text = dt.ToString
or
Dim dt As New DateTime(Year as integer, Month as integer, Day as integer) DateTimePicker1.Value = dt
hmm can't upload photos sir but i think your getting to the point hmmm so hard to explain but im going to try one more time if i use the mouse scroll or arrow key on the keyboard the date and month year would change to my desired user name i have a code in vb6 way way back but i forgot
i think were getting to understand each pther sir but im not trying it on my program XD
DimitriV, on 05 March 2012 - 01:19 AM, said:
I think I get it - you type a month, date and year and it will select accordingly. This is a quick solution that has no error handling but,
Dim d As String = InputBox("Enter date")
Dim m As String = InputBox("Enter month")
Dim y As String = InputBox("Enter Year")
Dim dt As DateTme = New DateTime(Integer.Parse(y), Integer.Parse(m), Integer.Parse(d))
DateTimePicker1.Value = dt
where should i put this code sir?
#7
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 01:35 AM
so you want to change date by selecting desired username?
#8
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 01:35 AM
Im a little confused. So you want to save the trouble of going back in the DateTimePicker and selecting dates from the past, is that right?
if you want to type in the date, my suggestion is to use a MaskedTextbox.
if you want to type in the date, my suggestion is to use a MaskedTextbox.
#9
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 01:38 AM
nK0de, on 05 March 2012 - 01:35 AM, said:
Im a little confused. So you want to save the trouble of going back in the DateTimePicker and selecting dates from the past, is that right?
if you want to type in the date, my suggestion is to use a MaskedTextbox.
if you want to type in the date, my suggestion is to use a MaskedTextbox.
but the same thing he can do with date time picker, isn't that right?
#10
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 01:43 AM
That's what I was thinking too. I remember it is possible. I'm not in a place to check it right now. That's why I'm not getting what the OP really wants.
#11
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 01:54 AM
nK0de, on 05 March 2012 - 01:35 AM, said:
Im a little confused. So you want to save the trouble of going back in the DateTimePicker and selecting dates from the past, is that right?
if you want to type in the date, my suggestion is to use a MaskedTextbox.
if you want to type in the date, my suggestion is to use a MaskedTextbox.
hmmm here sir i have a DateTimePicker and in it is Monday.March 05,2012 which is the current date today but what i want to do it that when you click the down arrow in it instead of click the arrow which you can select the month and the year i want it to just Monday.March click this and change the month by typing 05 click and type the date 2012 and that also goes with the year and by doing that i could manipulate the day that i want it to be its value for example my birthday i just want to reduce the hassle of click from the birthday in 1990 or anyone who would register their birthday it could be any year , hope its is clear now
This post has been edited by cj777: 05 March 2012 - 02:08 AM
#12
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 02:06 AM
you can use UP DOWN keys to select the month and you're able to just type in the date and the year in the DateTimePicker. No hassle at all.
#13
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 02:10 AM
for example: you can put this code in form load event. That will set dt picker automatically to year 1990. Than you only have to change day and month.
Dim dt As New DateTime(1990, Now.Month, Now.Day)
DateTimePicker1.Value = dt
#14
Re: DateTimePicker question in vb.net
Posted 05 March 2012 - 02:38 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|