2 Replies - 231 Views - Last Post: 16 July 2012 - 08:30 AM Rate Topic: -----

#1 hiral2cool  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 15-July 12

DataTimepicker Dates On Data Grid control

Posted 15 July 2012 - 11:51 PM

mtxtBdate.Value = dataGridView1.SelectedRows[0].Cells["Birthdate"].Value.ToString();

i want this on data Grid view.. this type of syntax use in all other textboxs.. but now how to use this datepicker control syntax.. this sytax is wrong plzz tell me write

meas any date that user select on the datetimepicker is show on the datagrid..

mtxtfname.text = datagridView1.SelectRows[0].Cells["fIrstname"].value.ToString();

this sytanx will for text box but for data picker ???

Is This A Good Question/Topic? 0
  • +

Replies To: DataTimepicker Dates On Data Grid control

#2 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 137
  • View blog
  • Posts: 829
  • Joined: 21-December 11

Re: DataTimepicker Dates On Data Grid control

Posted 16 July 2012 - 08:23 AM

type of mtxtBdate.Value is a DateTime.
Before you assign value to mtxtBdate you will need convert dataGridView1.SelectedRows[0].Cells["Birthdate"].Value to DateTime
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 1890
  • View blog
  • Posts: 5,678
  • Joined: 05-May 12

Re: DataTimepicker Dates On Data Grid control

Posted 16 July 2012 - 08:30 AM

You obviously are just using Intellisense to write your code and not bothering to read the documentation.

Assuming that mtxtBdate is a DateTimePicker, then the Value property takes a DateTime, not a string. Read here: http://msdn.microsof...cker.value.aspx

So if dataGridView1.SelectedRows[0].Cells["Birthdate"].Value, is already a DateTime, just assign it. No need to convert to a string. If not, then you'll have to do some magic to convert it to a DateTime.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1