By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

Datetimepicker

P: n/a
Hey Folks

i wanted to ask about the datetimepicker.
I want a messagebox to appear as soon as the user clicks on the datetimepicker.
I have tried the valuechanged event but i want the message to appear way before this stage. I want to display it as soon as the calender is displayed or as soon as the mouse is pressed on the control.

I tried the click event but this didnt work. this is what i tried:

Private Sub dtpRoomDate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles dtpRoomDate.Click
If LViewMealBookings.Items.Count > 0 Then
MsgBox("Changing the room date will cause all your meal bookings to be lost. Do you wish to continue?", vbYesNo)
If vbYes Then
dsFullBooking.Tables("dtMealBooking").Clear()
LViewMealBookings.Items.Clear()
End If
End If

End Sub

Can anyone help me?
Nov 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Cor
Hi Avni,

Try this
\\
If MsgBox("Changing the room date will cause all your meal bookings to be
lost. Do you wish to continue?", _
MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
//

I hope this helps?

Cor
Nov 22 '05 #2

P: n/a
Hello Cor

Thank u for the coding. What im confused on is what event to include this code under as i want the message to appear as soon as the user clicks on the dateTimePicker (i.e, before the calender appears). I have so far put this code on the valuechanged event, but i want this message to appear before the user gets the chance to change the date
If i have to include it in this valuechanged event, how do i ensure that if the user clicks 'NO' in the messagebox the date is not actually changed and is returned to its previous date

I tried including this code in the click event for the dtp but the messagebox never seemed to appear!!?
Nov 22 '05 #3

P: n/a
Cor
Hi Avni,

If you want not the user to select a date, why not give him a button on the
same place as the picker, after he has clicked it, you make the button
invissible and shows the picker.

Looks to me more friendly for the user, because that he can understand.

Or do I see something wrong?

Cor
Thank u for the coding. What im confused on is what event to include this code under as i want the message to appear as soon as the user clicks on the
dateTimePicker (i.e, before the calender appears). I have so far put this
code on the valuechanged event, but i want this message to appear before the
user gets the chance to change the date. If i have to include it in this valuechanged event, how do i ensure that

if the user clicks 'NO' in the messagebox the date is not actually changed
and is returned to its previous date?

Nov 22 '05 #4

P: n/a
Hi Cor

Do u know how i could revert the date back to its previous value if the user selects no in my messagebox
I have decided to use the valuechanged event
If the user selects yes then i want the date value to change toi whatever the user has selected. If they select no the old date is restored. Is this possible or not a good method

Nov 22 '05 #5

P: n/a
Cor
Hi Avni,

I nowhere have seen how you used the text from the datapicker.

There are so many posibilities, but they all depend on your program and I
think that is to big to investigate for me.

Cor

Do u know how i could revert the date back to its previous value if the user selects no in my messagebox? I have decided to use the valuechanged event.
If the user selects yes then i want the date value to change toi whatever the user has selected. If they select no the old date is restored. Is this
possible or not a good method?

Nov 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.