473,890 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid DateTimepicker column style

Hi, .Net experts,

I am using DatagridDateTim epickerColumn style posted on MSDN .net class
document in my datagrid. You can see the datagridDateTim epickerColumn style
at
http://msdn.microsoft.com/library/de...classtopic.asp

It works fine with the datetimepicker column of current record in datagrid.
But when I click the very last record in datagrid (which creates a record), I
got an exception. I debuged it. It occured right after leaving Edit
function. Can somebody tell me the reasion and how to fix it?

Thanks,

Karl

Nov 17 '05 #1
1 3825
Hi Karl
I am using DatagridDateTim epickerColumn style posted on MSDN .net class
document in my datagrid. You can see the datagridDateTim epickerColumn style
at:
http://msdn.microsoft.com/library/de...classtopic.asp

It works fine with the datetimepicker column of current record in datagrid.
But when I click the very last record in datagrid (which creates a record), I
got an exception. I debuged it. It occured right after leaving Edit
function. Can somebody tell me the reasion and how to fix it?


The standard DateTimePicker control from .NET does not support null values.
Its value property must always be a valid DateTime value.

When you click on the last line in the datagrid and thus create a new
record, what happens with your DateTime value? Is it set to DateTime.Now?
Or is it initalized with null? If the latter, you would try to set the
DateTimePickers value property to null and that would raise an exception.

If that is the problem you should use a DateTimePicker control that
supports null values like this one:
http://www.codeproject.com/cs/miscct...TimePicker.asp

hth
--
Claudio Grazioli
http://www.grazioli.ch
http://www.grazioli.ch/HommingbergerGepardenforelle/
Nov 17 '05 #2

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

Similar topics

1
2595
by: Soul | last post by:
*** I am not sure this question belong to *.languages.csharp or *.framework.windowsdorms.databinding, so I post to both *** Hi, Currently I have a DataGrid which bind to a DataSet. One of the column in the DataSet table consist of DateTime value. I also have two DateTimePicker (startDate and endDate) on my Windows form.
0
3558
by: Mauro | last post by:
Hi, I need a big help to resolve this problem. I need to put a usercontrol in a datagrid: this control check if the code inserted is present in a archive and if not return a error message. (In the example I have changed this check with a easy "if string is empty" ) Everything would be easy if the datagrid had a predictable behaviour. I explain my problem.
1
9351
by: Marty | last post by:
Is it possible to have a DateTimePicker in a DataGrid control date column? If so, can you please include some code. Thanks.
0
1664
by: ROG | last post by:
Hi all with help from postings on the web, i have a dateTimePicker in one of my columns in the datagrid. However, when i move in to this column using the arrow keys, it automatically pops up, and then any future arrow key presses start changing the date. I don't want this to happen - i'd like the arrow keys to continue navigating around the grid. For the dateTimePicker to become "active", i'd like the user to, say, have to press...
6
3502
by: Michael | last post by:
Hi all : I want to add button , dtpicker and combo box into datagrid. I don't want use 3rd party and I want write my own columnstyles. any reference / site to teach me how to do it ? Thanks for your help
1
1691
by: Robert Batt | last post by:
Hello, I have a bound datagrid that contains the following date column Dim tcQuoteduedate As New DataGridTextBoxColum tcQuoteduedate.MappingName = "MYCustomerCustomerTQuoteDueDate tcQuoteduedate.HeaderText = "Quote Due Date tcQuoteduedate.Width = 8 tcQuoteduedate.Format = "d tcQuoteduedate.NullText = " Is there any way that I can use a datetimepicker to allow the user to select from this datetimepicker in the datagrid, rather than...
0
1198
by: henk | last post by:
Hi, In my datagrid, a date time picker becomes visible when a user navigates to eg column 3. (with CurrentCellChanged and datetimepicker1.AddReqInfo.Visible = True) This works fine BUT: When I navigate to column 2 and hit the "tab" key, the datetimepicker becomes visible (Ok so far), but when I start typing eg a "4", it seems to place the text at the background of the datetimepicker (the original cell of the datagrid where the...
1
1060
by: rgirdler | last post by:
Greetings, can anyone tell me how to add the datetimepicker tool to a specific column in the datagrid when using C# ? I''ve tried to go through the datagrid> edit columns and then selecting the correct column I want to change. When I look under the Design heading there is a drop down with five different tools but datetimepicker is not one of them. Thanks for any assistance you can provide!
0
5663
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be blank unless they are filled by the user. 2) As soon as the user enters a cell, the dtp control should appear as the editing control of that cell. If there's a value in the cell beforehand, that value is set as the value of the dtp editing control...
0
9978
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, 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...
0
11232
Oralloy
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...
0
10462
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9633
agi2029
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...
1
8016
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 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...
0
7169
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();...
0
5851
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...
2
4271
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3277
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.