Datagrid field settings

  • Thread starter Sebastian Santacroce
  • Start date
S

Sebastian Santacroce

I'm trying to format datetime column in datagrid to a time
format rather than date. I'm using code:

Dim myGridTextBoxColumn As DataGridTextBoxColumn = New
DataGridTextBoxColumn()

myGridTextBoxColumn = CType(datagrid.TableStyles
(0).GridColumnStyles("StartDate"), DataGridTextBoxColumn)

myGridTextBoxColumn.Format="hh:mm:ss tt"

However, that last line always give error"Object reference
not set to an instance of an object."

What am I doing wrong?

Thank you

Sebastian
 
S

scorpion53061

Lot better experts than me but Try
myGridTextBoxColumn = Format(Date.Now, "hh:mm:ss")
 

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

Top