Expression Columns with Dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was wondering if someone could enlighten me about using date/time variables
in column expressions. I am trying to setup a timesheet style form. The
datatable that holds the information is filled by code, no database
interaction. I'm aware of the DateDiff function in SQL, but I can't get it to
work in an expression column. Is there another function that I should be
using, or do I have to do a work-around in code?
 
Gary,

Does this simple sample answer the question?

Cor

\\\Needs only a datagrid on a form
Private Sub Form1_Load(ByVal sender As _
Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim dt As New DataTable
dt.Columns.Add("dat", GetType(System.DateTime))
For i As Integer = 0 To 5
Dim dr As DataRow = dt.NewRow
dr(0) = Now.AddDays(i)
dt.Rows.Add(dr)
Next
DataGrid1.DataSource = dt
End Sub
///
 
Back
Top