Hello!
I have a table with a column called: "DGV_Date_Column", it contains the dates of my sale tickets. I've sent these values to a DataGridView1 and I'm trying to display de total amount of tickets in a Label1.Text. I mean all rows with the same date and time belong to a single ticket, so in the image I show 3 tickets total, and I need to display this total in the Label1.Text
this is what my table looks like:
![Name: image20.jpg
Views: 57
Size: 31.8 KB]()
This is my attempt to do it, but no success.
I'll appreciate any help.
Thank you.
I have a table with a column called: "DGV_Date_Column", it contains the dates of my sale tickets. I've sent these values to a DataGridView1 and I'm trying to display de total amount of tickets in a Label1.Text. I mean all rows with the same date and time belong to a single ticket, so in the image I show 3 tickets total, and I need to display this total in the Label1.Text
this is what my table looks like:
This is my attempt to do it, but no success.
VB.NET Code:
If DataGridView1.Rows.Count <= 0 Then Else Dim number_of_tickets As Integer = 0 Dim Date_and_Time As String = "" For Each row1 As DataGridViewRow In DataGridView1.Rows Date_and_Time = row1.Cells("DGV_Date_Column").Value If row1.Cells("DGV_Date_Column").Value <> Date_and_Time Then number_of_tickets += 1 Else End If Next Label1.Text = number_of_tickets End If
I'll appreciate any help.
Thank you.