I have a datagridview that tracks when employees clock in and out. I used the datetime data type in sql but I dont want the year to display. How would i go about doing this? Do i have to modify my select statement, or can I do it with vb code?


Thanks in advance

Recommended Answers

All 5 Replies

Thats sort of what im looking for. I have this so far:
DGVTime.Columns("InOuTime").

InOutTime is my variable in sql but im stuck at this part.

try using these example textbox1.text = (cell of the grid).tostring("hh:mm:ss") just give it a try

Here is sample:

Dim col1 As New DataGridViewTextBoxColumn
        col1.DefaultCellStyle.Format = "t" 'Time format
        col1.DataPropertyName = "ColumnName"

        DataGridView1.Columns.Add(col1)
        DataGridView1.DataSource = dt  'Instance of DataTable
commented: Always helpfull! +1

adatapost's code worked. Thanks guys!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.