Using the DataGridViewProgressColumn class

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am trying referencing the thread "social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/769ca9d6-1e9d-4d76-8c23-db535b2f19c2" (add your own http://)
I am trying to implement the code, but I cannot seem to assign a value to the progresscolumn cell.
I have tried 2 different ways to add the column to my datagridview object.
The datagridview is populated by a database query, so I have this property:
DataGridView1.AutoGenerateColumns = True
Here is one way that I have added the column:
Dim ProgressColumn As New DataGridViewProgressColumn
ProgressColumn.HeaderText = "Progress"
ProgressColumn.Name = "Progress"
ProgressColumn.Visible = True
DataGridView1.Columns.Add(ProgressColumn)
Now to assign the values after populating the datagridview, I do this:
For Each dRow As DataGridViewRow In DataGridView1.Rows
If dRow.Cells(struct_RM_SelectedColumns.QUANTITY).Value > 0 Then
dRow.Cells("Progress").Value = Convert.ToInt32((dRow.Cells(struct_RM_SelectedColumns.PRODUCED).Value / dRow.Cells(struct_RM_SelectedColumns.QUANTITY).Value) * 100)
Else
dRow.Cells("Progress").Value = 0
End If
Next dRow
In every case, the display shows a label "0%" in the cell.
Can someone show me how to utilize this class properly?
Thanks.

View the full article
 
Back
Top