Here Mark Rideout, a Microsoft developer explains how to create a progress bar column in a DataGridView, and provides a "bare-bone" code for DataGridViewProgressColumn class. His instructions on how to use it for databound datagridviews are:
Some people, including myself do not understand what does it mean to "change the column type of an integer column that has 0 through 100 values" in the case with databound grid, and Mark seems to be too busy to answer. Does anyone know how it is done?
Here is a quick sample of my case:
namespace Sample
{
public class Record
{
public int Id { get; set; }
public string Name { get; set; }
public int Progress { get; set; } // This is the int 0-100 field which
// has data for a progress bar
public Record()
{
}
public Record(int id, string name, int progress)
{
this.Id = id;
this.Name = name;
this.Progress= progress;
}
}
}
namespace Sample
{
public partial class SampleForm : Form
{
private BindingList<Record> records;
public SampleForm()
{
InitializeComponent();
}
public SampleForm(BindingList<Record> records)
{
InitializeComponent();
this.records = records;
}
private void SampleForm_Load(object sender, EventArgs e)
{
dataGridView1.DataSource = this.records;
}
}
}
At what point exactly should I change the "Progress" column type to DataGridViewProgressColumn, and how is that done?