473,498 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calendar control SelectionChanged event

Hi all,

I just tried to handle the SelectionChanged event using a calendar
control to popoulate a textbox. I got "12:00:00 AM" instead of the date..
i.e. "11/1/2006" my snippet is

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Calendar1.SelectionChanged

TxtEventDate.Text = Calendar1.SelectedDate.ToLongTimeString()

End Sub

Thanks in advance,

Carlos
Nov 1 '06 #1
3 1930
ToLongTimeString() is for displaying time.
You should use ToLongDateString() and ToShortDateString() if you want
the *DATE* to be displayed.

Regards,

Bill.

-----------------------------------------------------------------------------------------
http://www.infosnap.eu

InfoSnap · the powerful, all-purpose information and knowledge-base manager.

-----------------------------------------------------------------------------------------
Carlos wrote:
Hi all,

I just tried to handle the SelectionChanged event using a calendar
control to popoulate a textbox. I got "12:00:00 AM" instead of the date..
i.e. "11/1/2006" my snippet is

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Calendar1.SelectionChanged

TxtEventDate.Text = Calendar1.SelectedDate.ToLongTimeString()

End Sub

Thanks in advance,

Carlos

Nov 1 '06 #2
You received the time because you asked for it. Thats the format that
is returned by ToLongTimeString(). If you want just the date use
ToLongDateString() for "Monday, December 25, 2006" or use
ToShortDateString() for "12/25/2006". What format are you trying to
get?

Merry Christmas.

Nov 1 '06 #3
"Carlos" <ch******@yahoo.comwrote in message
news:ed**************@TK2MSFTNGP03.phx.gbl...
I just tried to handle the SelectionChanged event using a calendar
control to popoulate a textbox. I got "12:00:00 AM" instead of the date..
i.e. "11/1/2006" my snippet is

Protected Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles Calendar1.SelectionChanged

TxtEventDate.Text = Calendar1.SelectedDate.ToLongTimeString()
TxtEventDate.Text = Calendar1.SelectedDate.ToString("MM/d/yyyy");

You might also consider using a non-ambiguous date format string e.g. "dd
MMM yyyy" - for most of us in Europe, 11/1/2006 is 11th January...
Nov 1 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2670
by: Colin Young | last post by:
I have a UserControl that contains a calendar control. The calendar is not raising events (month navigation, date selections, etc.). I've checked that the OnSelectionChanged event has a handler...
0
1265
by: Jimmy | last post by:
I am using Calendar control in my ASP.Net application. When the user clicks a command button, I am making it(calendar control) visible. Once the user selects the date, I am making calendar contol...
2
1377
by: D. Shane Fowlkes | last post by:
http://www.drumpub.com/caltest.aspx Check the test page at the above link. Could someone please tell me why I'm capturing the calendar's SelectedDate "one post behind"? The source code is on...
0
1119
by: Luis Esteban Valencia | last post by:
Hi folks, I have a problem using the Calendar Control. Let me explain: On my first page, "Default.aspx", I have a calendar control named "calPrimary". I then have a Web User Control on the...
1
1355
by: MattB | last post by:
Hi. I posted yesterday about being able to get to Day.IsSelecteable from outside the calendar's DayRender event. I never figured that out, so I found another way to do what I needed by...
3
1464
by: Peter | last post by:
I have a page that has multiple calendars on it and sync off of the DayRendered event on each control. My problem is that if a user clicks on one calendar, it causes a refresh and kicks off all the...
1
1160
by: P K | last post by:
I have around 20 calendar controls on my screen besides 20 textboxes. The functionality of each control is the same, they take in a parameter for the textbox name and open a calendar in a popup....
2
1821
by: Mariano Padilla | last post by:
The calendar control only has the event of SelectionChanged to detect if the user clicks on the calendar. I have 2 calendars on a form, one for arrival date one for departure date. Every time a...
24
9642
by: =?Utf-8?B?Tkg=?= | last post by:
I have a basic calendar and a SelectionChanged event (asp.net 2.0). How can I handle it when a user chooses the same date again, in this case the SelectionChanged event is not fired because,...
0
7126
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7005
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7210
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3087
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.