I have a DateTimePicker control that originally displays "1/1/1900" on
screen. I want to change it to current date when a user clicks on it. I use
the follow code but nothing is happening. Can someone tell me what I'm doing
wrong?
Thanks, Alpha
private void dtpLastOdoDate_ Click(object sender, System.EventArg s e)
{
dtpLastOdoDate. Value = DateTime.Today. Date;
} 5 5433
dtpLastOdoDate. Update(); // ??
"Alpha" wrote: I have a DateTimePicker control that originally displays "1/1/1900" on screen. I want to change it to current date when a user clicks on it. I use the follow code but nothing is happening. Can someone tell me what I'm doing wrong? Thanks, Alpha
private void dtpLastOdoDate_ Click(object sender, System.EventArg s e) { dtpLastOdoDate. Value = DateTime.Today. Date; }
Thanks John. I added the code you suggested
dtpLastOdoDate. Update();
but it still not working.
"John" wrote: dtpLastOdoDate. Update(); // ??
"Alpha" wrote:
I have a DateTimePicker control that originally displays "1/1/1900" on screen. I want to change it to current date when a user clicks on it. I use the follow code but nothing is happening. Can someone tell me what I'm doing wrong? Thanks, Alpha
private void dtpLastOdoDate_ Click(object sender, System.EventArg s e) { dtpLastOdoDate. Value = DateTime.Today. Date; }
i doubt we have a click event for the datetimepicker control.
instead to achieve ur thing. write the code in Enter event handler of
the datetimepicker control.
There is a Click event but it does nothing with the code I put in there. The
Enter event is working out just great. Thank you Chandra.
"chandra" wrote: i doubt we have a click event for the datetimepicker control.
instead to achieve ur thing. write the code in Enter event handler of the datetimepicker control.
On Thu, 29 Dec 2005 12:37:02 -0800, "Alpha"
<Al***@discussi ons.microsoft.c om> wrote: I have a DateTimePicker control that originally displays "1/1/1900" on screen. I want to change it to current date when a user clicks on it. I use the follow code but nothing is happening. Can someone tell me what I'm doing wrong? Thanks, Alpha
private void dtpLastOdoDate_ Click(object sender, System.EventArg s e) { dtpLastOdoDate. Value = DateTime.Today. Date; }
The DateTimeOicker display defaults to the current date and time. You
must be setting the vale of it to null or something in your code.
Why must the user click the control to get it to display the current
date? Why not just let it display the default. If you don't want the
time, just set the Format property to Short. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Richard |
last post by:
Hi,
I have a DateTime picker control on a form. The datetime
picker control is data bound to a column in a DataTable.
Yes I know about bound DateTime pickers and DBNull and
etc. so no troubles with that stuff...
However, as somebody out there probably knows,
programmatically setting the DateTimePicker.Value property
to a new VALUE does NOT in itself constitute a CHANGE to
|
by: Jacek Jurkowski |
last post by:
.... the minimum date of DateTimePicker is 1753-01-01.
How to make DateTime to do not show nothing in its
text if this date is the value? I have a form with a field
LastLogonDate. If user hasn't logon yet this date should
be empty but when binding a property to the DateTimePicker value it always
shows value parsed
prom property which is 1753-01-01. How to make
an "empty" or "not set" date bindable to a value property
of DateTimePicker?
|
by: Craig831 |
last post by:
First off, I apologize if this gets long. I'm simply trying to give you all
enough information to help me out. I'm writing (almost finished, actually),
my first VB.Net application. It's a forms application that is going to be
used to extract data from a legacy system (VSAM based mainframe file
structure), and output data in pipe-delimited record layouts, multiple record
types per file, one file per chosen client. I have been working on...
|
by: Darin |
last post by:
Is there a way to, at runtime, change a textbox to be a datetimepicker?
I have a form that I allow the user to specify what field types the
input boxes are. They can be regular text, integer, money, date, or
date&time. So, I have the textbox and when I see that this field is a
date, I want to change the textbox to a datetimepicker. Can that be done
at runtime?
TIA
|
by: gumi |
last post by:
Hi,
I am looking for code for a alarm clock program that pops up a messege to be
used as part of my VB.Net class project. Any help is very much appreciated.
Thanks
| |
by: Clamara |
last post by:
When adding a new record from my form, I pre-set my DateTimePicker's value to
System.DateTime.Today
Since the "Today" value is used most of the time, the user doesn't need to
select a date from the DateTimePicker, since the default is shown. My problem
is, if the user does not choose a value from the DateTimePicker (because
using the default is good enough), then during database update, the date
value is not saved to the database; while if...
|
by: Charlie |
last post by:
In the top portion of the DateTimePicker, where the value of the date is
displayed, how can I detect whether the month or day or year is currently
focused, or, if ShowCheckBox = True, whether the checkbox is focused?
|
by: jehugaleahsa |
last post by:
Hello:
We were hoping to allow users to have DateTimePicker value null so
that a unused date is stored on a Database. Does the control support
this? I am pretty sure it doesn't.
How would you go about representing this to a user so they are not
confused?
Thanks,
|
by: Todd Carnes |
last post by:
I am trying to write an app in C# that requires the user to enter a date
from 4000 B.C.E to 4000 C.E. I tried to use the DateTimePicker Control
to allow the user to enter the date, but it only supports the Gregorian
Calendar, so the earliest date it allows is in 1752 C.E.
Is there a way to override the DateTimePicker control's minimum allowed
date, or am I forced to resort to the less user-friendly use of three
separate text boxes for...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |