Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Link DataGridView with a dynamic excel

$
0
0

I have an a datagridview that I create on my form, I would like to display which information is availlable on a specified sheet, with a specified cell.

But the problem is a bit more complex because the excel file changes dinamically, and i want to the datagridview display in direct time what is in the excel file, I have no clue if that is possible.

I did the creation of the datagridview and I manage my excel sheet :

 

int numLastSheet = xlWorkbook.Worksheets.Count; Worksheet xlNewSpreadTemplate = (Worksheet)xlWorkbook.Worksheets.Item[Variables.strSheetStratSpread]; xlNewSpreadTemplate.Copy(Type.Missing, xlWorkbook.Worksheets.Item[numLastSheet]); xlNewSpreadTemplate = (Worksheet)xlWorkbook.Worksheets.Item[numLastSheet + 1]; xlNewSpreadTemplate.Name = strategyItemSpread.paramConsoleStrategyName; xlWorkbook.Save(); var dataGridView = new DataGridView(); strategyItemSpread.consoleStrategyItemBlock.Controls.Add(dataGridView); dataGridView.Location = new Point(75, 40); dataGridView.Size = new Size(700, 70); CreateCellsDGV(dataGridView, 6, 1, strategyItemSpread.Name); dataGridView.Name = "strategySpreadDgv" + Variables.maxIDFutureStrategy;

Moreover I know how to interact between them with this line :
dataGridView.Rows[1].Cells[1].Value = (..)

Now lets say I want in the: - first column the element dynamically manage of B11 in the excel - second column the element B12 (...)

any idea ?


Viewing all articles
Browse latest Browse all 2535

Trending Articles



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