I have been trying to convert the c# code in the link below (customer control in datagridview column) but i am getting errors. Can you pls assist me with the correct way of achieving that
https://docs.wisej.com/docs/controls/lists/datagridview
C# Code
this.dataGridView1.Rows[0][2].Control = new TrackBar
{
Value = 10,
Dock = DockStyle.Fill
};
VB.Net Code
dataGridView1.Rows(0)(3).Control = New ProgressBar (Value = 10, Dock = DockStyle.Fill)
dataGridView1.Rows(0)(3).Control = New ProgressBar {Value = 10, Dock = DockStyle.Fill}
Hi Nicholas,
I just wanted to also point out that with this here you’re going to create a Control for each individual cell.
if the grid has 1000 rows it creates a 1000 controls. if it’s just meant to display custom content in a grid cell then the answer in one of your previous posts (https://wisej.com/support/question/display-progrgress-percentage-in-datagridview-column) is the right thing to do.
//
Hi Nicholas,
You can achieve your goal using :
'1
Dim progressBar As New ProgressBar
progressBar.Value = 10
progressBar.Dock = DockStyle.Fill
dataGridView1.Rows(0)(3).Control = prog
or
'2
dataGridView1.Rows(0)(3).Control = New ProgressBar With {.Value = 10, .Dock = DockStyle.Fill}
HTH,
Alaa
Please login first to submit.