Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

Datagridview column datatypes

$
0
0
I'm having a slight issue displaying images in my DataGridView...

I am importing a CSV file to a datatable No problem.
I am then naming the column names like so dt.columns(0) = "Name" etc..

no problem so far..

I have a routine that looks for text and replaces it with an image, this also works as long as I create the column like so:

.Columns.AddRange( _
New DataGridViewTextBoxColumn(), _
New DataGridViewTextBoxColumn(), _
New DataGridViewTextBoxColumn(), _
New DataGridViewTextBoxColumn(), _
New DataGridViewTextBoxColumn(), _
New DataGridViewTextBoxColumn(), _
New DataGridViewTextBoxColumn(), _
New DataGridViewImageColumn()) ' Note that my last column is an image column...


Now, I use this command to import the datatable in to the datagrid:

dataGridView1.DataSource = dt

Of course I can't use the above method to create the image column as it will just add columns after ones I've already created so how can I change the datagridview column to display images before I use:
dataGridView1.DataSource = dt??

I need to be able to bind to the datatable and still be able to display images.

Any help would be great.

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>