Hello!
Please I need some help, I've been scratching my head for a while trying to figure out this...
I want to update some DGV cells with the values from another DGV cells, all this on the Load event of my form, something like this:
![Name: 2a.jpg
Views: 11104
Size: 41.1 KB]()
I can manually update specific cells on a DGV, my problem is... I don't know how to do this automatically.
OK, I have 2 DGVs:
DataGridView2: (the one at the top) it has no bindings, it is just populated at run time.
DataGridView1: (the one at the bottom) it is bound to a database table.
DataGridView2 is populated with the following code (No problem here!):
My attempt to update the cell values on DataGridView2:
Please, I'll appreciate any help!
Please I need some help, I've been scratching my head for a while trying to figure out this...
I want to update some DGV cells with the values from another DGV cells, all this on the Load event of my form, something like this:
I can manually update specific cells on a DGV, my problem is... I don't know how to do this automatically.
OK, I have 2 DGVs:
DataGridView2: (the one at the top) it has no bindings, it is just populated at run time.
DataGridView1: (the one at the bottom) it is bound to a database table.
DataGridView2 is populated with the following code (No problem here!):
VB.NET Code:
DataGridView2.Columns.Add(0, "Horario") Dim I As Integer For Each item As String In ComboBox4.Items 'get the column names from this ComboBox DataGridView2.Columns.Add(I, item) I += 1 Next Dim limite As Integer Dim StartTime As TimeSpan = TimeSpan.Parse("08:00") 'starts shift Dim EndTime As TimeSpan = TimeSpan.Parse("17:00") 'Ends shift Dim duration = EndTime - StartTime Dim durationInmins = duration.TotalMinutes limite = Math.Abs(durationInmins) / 10 'Generates the time values on column [Horario] Dim temp As Date = #01/01/0001 08:00# Dim starter As Date = temp starter = starter.AddMinutes(-10) Dim minu As Double = 10.0 For s As Integer = 0 To limite starter = starter.AddMinutes(minu) DataGridView2.Rows.Add(starter.ToShortTimeString()) Next
My attempt to update the cell values on DataGridView2:
VB.NET Code:
For Each col As DataGridViewColumn In DataGridView2.Columns For Each row As DataGridViewRow In DataGridView1.Rows Dim time_row As String = row.Cells("Horario_Inicia").Value If row.Cells("Barbero").Value = "Max" Then DataGridView2.Item(2, 2).Value = (row.Cells("Barbero").Value) '(Col, row) Else DataGridView2.Rows.Add() End If Next Next
Please, I'll appreciate any help!