Q: DataGridView.

  • Thread starter Martin Arvidsson, Visual Systems AB
  • Start date
M

Martin Arvidsson, Visual Systems AB

Hi all you gurus out there ;) I am not sure i am posting this in the correct
NG. But i will give it a go.

I have a as you see from the snippet below, a datagrid, i have a daset that
i fill with data.
the data is not collected from a database but from the GetFiles method.

Now, the column names are not changed for somehow, but remains as the
fieldnames in the DataSet? How to change this behaviour?

Also, links to datagridview management would be higly appreciated

dataGridView1.DataMember = DataSetUnusedFiles.Tables[0].TableName;
dataGridView1.DataSource = DataSetUnusedFiles;
dataGridView1.Columns[0].Name = "Delete";
dataGridView1.Columns[1].Name = "Filename";
dataGridView1.Columns[2].Name = "Location";

Regards
Martin
 
M

Marc Gravell

What are you expecting to see? Perhaps you need to change
DataGridViewColumn.HeaderText, not Name.

For reference, you don't actaully *need* to use a DataSet with
DataGridView; you could just as easily give it an array of FileInfo
objects, or any other class of object (such as
MyBespokeFileRepresentation); the DataGridViewColumn.DataPropertyName
will be used to map to a class property for regular classes.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top