Reading an Unbound DataGridView Control with VB 2005

  • Thread starter Thread starter dm1608
  • Start date Start date
D

dm1608

Hello, I have a DataGridView control in VB.NET 2005 that I would like to
iterate thru row by row and parse out the individual columns into variables.
Can someone provide me example code or direct me to a document that shows
how this can be done?

Thank you
 
dm1608 said:
Hello, I have a DataGridView control in VB.NET 2005 that I would like to
iterate thru row by row and parse out the individual columns into variables.
Can someone provide me example code or direct me to a document that shows
how this can be done?

Thank you

I believe this is right, I'm doing it from memory w/o VB.

For ii = 0 to DataGridView.Rows.Count -1
for ix = 0 to DataGridView.Columns.Count
debug.Writeline(DataGridView.Rows(ii)(ix).ToString)
next
End
 
That's cool... thanks!

Another question... do you know how I can clear the DataGridView so I can
reload?

I guess I have two possible requirements:

1) Delete all rows
2) Delete all rows and column headers so I can add new one and change text,
etc.

Thanks again!
 
Does anyone know how to make the DataGridView so I can select a column and
copy it to my clipboard? It looks like I have the sorting enabled, so it
doesn't highlight the columns???

Also, assuming I want to create just a button to copy a particle column to
the clipboard, what is the code for this?
 
DM,

You should forever try to avoid with windowforms datacontrols to access the
control direct.

Use the underlying datasource (datatable, dataview, etc).

Cor
 

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

Back
Top