I'm try'ing to get the time in a field in a datagrid. It shoul be the time of inserting the record. When i use the defaultvalue of the grid it puts the time of creating the grid in the field.
conn = OpenOleDbConnection(_DbPath & "\RegLoBe.mdb")
'Set the DataAdapter's query.
da = New OleDbDataAdapter("Select * from Proef ", conn)
cb = New OleDbCommandBuilder(da)
ds = New DataSet()
' Fill the DataSet.
da.FillSchema(ds, SchemaType.Source, "Proef")
da.Fill(ds, "Proef")
setting the default view will set a static value to the datatable, what I have done is when the RowChanged event gts fired I update the defaultview with the current time.
VB Code:
Private Sub _DataTable_RowChanged(ByVal sender As Object, ByVal e As System.Data.DataRowChangeEventArgs) Handles _DataTable.RowChanged
Dim NewDate As String = Now.ToString
_DataTable.Columns(3).DefaultValue = NewDate
End Sub
unless someone know of a better way
If your post is resolved, mark it as such using the thread tools, Keep the forums tidy.
I was hoping there was an RowAdded event. I have solved it the way you said.
If the time is null then inster time. The only problem is that when somebody doenst want a time and deletes it, the event puts it back again. :-(
you can set that column to be read only, by modifiying the datacolumn. Just take a look at the datatable if your using one. I enclosed a 2003 app that will show you how to create a dataTable and attach it to a dataset, inside this it shows how to create data columns that you can alter to your liking.
If your post is resolved, mark it as such using the thread tools, Keep the forums tidy.