473,666 Members | 2,539 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 3813
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
2589
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
3545
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
9341
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
1648
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
3487
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
1682
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
1190
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
1055
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
5646
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
8454
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
8363
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8787
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 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...
1
8561
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8645
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
5672
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
4200
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...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1778
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.