Datagridview Custom Control (VB.Net)


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

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}

  • You must to post comments
Best Answer

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 ( is the right thing to do.

Adding to that you don’t even have to change the value of the cell with HTML, but you can instead handle CellFormatting and format what is rendered in the cell without putting html in the cell value.
Let me know if you need anything!


  • Nicholas
    Thanks Alaa for the quick response. Yes all i wanted to achieve was to display the column as a progress bar. I tried the solution in my earlier question but was having issues and that is why i was looking for an alternative. I played with the earlier sample after your suggestion and i have been able to achieve exactly what i need. Thanks so much for the suggestion.
  • You must to post comments

Hi Nicholas,

You can achieve your goal using :

Dim progressBar As New ProgressBar
progressBar.Value = 10
progressBar.Dock = DockStyle.Fill

dataGridView1.Rows(0)(3).Control = prog


dataGridView1.Rows(0)(3).Control = New ProgressBar With {.Value = 10, .Dock = DockStyle.Fill}


  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.