Search code examples
databasevb.netms-accessdatagridviewdatagrid

VB - DataGridView Hour column shows as decimal and Update DataGridView


I'm having a problem. I inserted data to a datagridview through the properties of it , through databindings as shown : DataBindings

And the database is from a access which is connected to an excel. Now I would ask for all your expertise about this issue:

  • The hours instead of showing as hh:mm show has decimal like this: Decimal Hours
  • Plus I want to refresh/update the datagridview with a timer, and until this date i have used this code.

Can someone help me please? Thank you in advance. Kind Regards


Solution

  • You need to add columns to the DataGridView, either programatically or via gui (right-click DGV, Edit Columns, Add...). Remember to set DataPropertyname to what you have in your database input as a column name. Here you have DefaultCellStyle property, which after you go into it's details has Format property. Select "Date Time" format type or set your custom format, i.e. "00:00". Edit columns Dialogs

    By the way, if you have two very different questions, you are requested to place them in separate threads. Furthermore, to answer your question about update, the comunity certainly needs to see a code you're using.