Date button to add date to grid

  • Thread starter Thread starter Jim Campau
  • Start date Start date
J

Jim Campau

Does anyone know how I can create a button that will enter the date Now into
a datetime field on a data grid?

Thanks in advance
 
Hi Jim,

You can add the following code in the Button_Click event handler:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Specify the row and column number for the cell whose value you wish to change

Me.DataGrid1(1, 1) = Now

End Sub

To change the value of the current cell, you can use:

Me.DataGrid1(Me.DataGrid1.CurrentCell) = Now

Hope this helps.

Thanks

Mona[Grapecity]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top