Masking a Binding DataGrid control
[code]
Dim bndTemp As Binding
bndTemp = New Binding("Text", DsCustomersDB1, "tblCustomers.fldCustPFCDate")
txtCustPFC.DataBindings.Add(bndTemp)
[code]
The result of the above code has variable fldCustPFCDate with the value of: 9/1/2005 12:00:00 AM
In my Access tblCustomers data table, fldCustPFCDate has a format of short date and only contains the date: 9/1/2005 as its value.
My question is how do I mask this New Binding statement to show only the date?
Thanks,
Soleman
Re: Masking a Binding DataGrid control
Maybe like this:
VB Code:
Dim bndTemp As Binding
bndTemp = New Binding("Text", DsCustomersDB1, ctype("tblCustomers.fldCustPFCDate",date).ToShortDateString)
txtCustPFC.DataBindings.Add(bndTemp)
Re: Masking a Binding DataGrid control
Hi Wild Bill!
I tried your suggestion and a get the following error:
Cast from string "tblCustomers.fldCustPFCDate" to type 'Date' is not valid
Re: Masking a Binding DataGrid control
VB Code:
For Each dr As DataRow In DsCustomersDB1.Tables("tblCustomers").Rows
dr.Item("fldCustPFCDate") = CType(dr.Item("fldCustPFCDate"), Date).ToShortDateString
Next
Dim bndTemp As Binding = New Binding("Text", DsCustomersDB1.Tables("tblCustomers"), "fldCustPFCDate")
txtCustPFC.DataBindings.Add(bndTemp)