c# datagrid time information - c#

The User inputs the time information in three different textboxes: hours/mins/seconds.
The time information is stored as total in an xml file in seconds.
The user can edit this value within a datagrid. In the datagrid the time information is shown as seconds. How can I achive that the value stored in seconds shows up in the datagrid in a more human readable format and so that the user can edit it in this way?
e.g. 4205 seconds = 1h 10m 5s
IS there a control or something similar?

You could always build a converter to take the bound value of seconds and spit out a desired string.

Related

How to set Format for DateTimePicker in WPF

In my application I'm using the DateTimePicker control from the Xceed Wpf toolkit.
I would like to set the format so that only the hours and minutes can be edited, I want to remove the calendar. since I'm using DateTimePicker to establish how long a process takes. Like this 3d print, it took 20h 40m and save it in my database.
enter image description here only this part
To set the format of the Xceed DateTimePicker control to only show hours and minutes, you can set the Format property to "HH:mm". This will display the time in hours and minutes, and only the time portion can be edited.
Example:
<xctk:DateTimePicker Format="HH:mm" />
This will format the control to only show and allow editing of the hour and minute values.

"Custom" selection mode in DataGridView

I have set up a DataGridView which shows hourly values in a grid (1 column for each day, 24 rows). For my users' convenience, I would like them to be able to easily select a time interval and include all the values in between (see pictures). Preferably via a Shift+Click+DrawMouse operation, or a Click followed by a Shift+Click.
This doesn't seem to be a standard selection mode in DataGridView. Does anyone have a suggestion for solving this?

ListView with 6000 rows c#

I am with a little issue on handling with one of my applications.
I have a Vessel's historic which is shown on a ListView, but until now I have never needed to show all the data inside this history (the user was using kind of a filter to get what he needed), but now one of the managers want to see all data through the application (they was receiving the full data through an excel report).
The biggest issue is because its 6000 rows with 21 columns each one and when I try to select all the data it takes something between 5 minutes to fully load, but more than that the user need to add new, edit or copy the history, which brings him to a new update on the list with more 5 minutes to load.
I don't quite know how is the best way to handle with this and I wanted your help!
I would actually split the information into sections. Rather than loading 6,000 rows plus columns all at once, why don't you use something like alphabetize the information? Use a different ListView for A-G, then another ListView for H-O, then so on and so forth. That why it would cut down the time it took to query all of the information.

DataGridView - changing cell format after writing data

I have a DataGridView (DGV) object which is populated by a method which dynamically adjusts the number of columns and takes column header information from the first row of data. I have no choice but to set the column names AFTER the DGV object has been populated (the column names can also change depending on the data they contain).
However, occasionally the source data contains dates. I know the cell format can be set at the time of creation but for me this assumes I know the number of columns and type of data in advance. So my question is, is it possible to set the data type property for a specific cell to DateTime AFTER all the data has been populated and have this actually take effect so that I can actually sort by date? I tried it, but the data is still treated as text and sorting takes place based on the alphabet (not date).
I've seen various examples where it is done at source and in an ideal world I would re-write my method to accommodate this requirement, but I'm an amateur and looking for a quick win :)
Anybody?
Thanks

How to Only changed data from access database

Hi I have a database to which new data is added every minute. I have a C# datagrid in winform which displays this db table. We refresh this datagrid every 5 minutes. Is there a way I show only the new added data and not the older ones
You can do this thropugh adding timestamp in your database.
By this you can set the limit of timestamp means , you will have to query the database to show only last 5 minutes time stamp's update in your grid.
Can also set the limit in query if its needed to limit the data in gridview.
This you can do in ASP.net as well as winforms.
You can do this by filtering the records descending with the newly generated uniqueId and also get the specific data with some limit (1 -10 the limit can be defined by you).

Categories