Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: 1 Mar 2006 07:18:01 -0800,    group: microsoft.public.dotnet.datatools        back       


DateTimePicker on datagridView   
Hi all

In table dtTasks there are 3 fields, ID, Name and birthDate.
I fill dtTasks with adapter and bind it like below.

dgview.DataSource = dtTasks;

Code above automatically creates columns and insert rows to
datagridview.
At this point i want to select Birth date from dateTimePicker.

I need a code that will make me use DateTimePicker for Birthdate
column.

But i don't want to add columns and rows manually.

Thanks and best regards.
date: 1 Mar 2006 07:18:01 -0800   author:   Cenk

RE: DateTimePicker on datagridView   
To host a DateTimePicker in a DataGridView column you must define a new class 
that inherits from DataGridViewColumn. You can find the whole class in the 
documentation “How to: Host Controls in Windows Forms DataGridView Cells”, 
it’s called CalendarColumn (in my machine, the cocumentation address is: 
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_fxmclictl/html/e79a9d4e-64ec-41f5-93ec-f5492633cbb2.htm). 
In the example you will find a form called Form1, you may take it off.

Copy the code, add a new item to the project of type class.vb, and paste the 
code there.

Now, when creating the dataGridView, if you dropped it from the toolBox, you 
must first remove the column from the DataGridView, since you will create the 
column programmatically. 

Then, in the Form’s Load Event Handler, you must write (suppose your 
dataGridView control is called myDataGridView):

    Dim CalendarCol As New CalendarColumn()
    CalendarCol.Name = "<the name of the column>"
    CalendarCol.DataPropertyName = "<the name of the field in the DataBase>"
    myDataGridView.Columns.Add(CalendarCol)

Done.

Hope this helps!

-- 

Other_Developer_More


"Cenk" wrote:

> Hi all
> 
> In table dtTasks there are 3 fields, ID, Name and birthDate.
> I fill dtTasks with adapter and bind it like below.
> 
> dgview.DataSource = dtTasks;
> 
> Code above automatically creates columns and insert rows to
> datagridview.
> At this point i want to select Birth date from dateTimePicker.
> 
> I need a code that will make me use DateTimePicker for Birthdate
> column.
> 
> But i don't want to add columns and rows manually.
> 
> Thanks and best regards.
> 
>
date: Mon, 6 Mar 2006 13:21:29 -0800   author:   Other_Developer_More

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us