Click here to Skip to main content
15,919,340 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
lsconyer8-Apr-08 3:30
lsconyer8-Apr-08 3:30 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza8-Apr-08 4:33
Walaza8-Apr-08 4:33 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza8-Apr-08 20:08
Walaza8-Apr-08 20:08 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet [modified] Pin
lsconyer9-Apr-08 1:48
lsconyer9-Apr-08 1:48 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza9-Apr-08 3:30
Walaza9-Apr-08 3:30 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
lsconyer9-Apr-08 3:46
lsconyer9-Apr-08 3:46 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
Walaza9-Apr-08 4:21
Walaza9-Apr-08 4:21 
GeneralRe: Dynamically add TabPages to my form depending on the number of worksheets in a spreadsheet Pin
lsconyer9-Apr-08 6:09
lsconyer9-Apr-08 6:09 
Just about your whole code needs to be rewritten. I think you're making this harder on yourself than you needed to. The reason nothing is happening is because tbControl is a new tabcontrol with no tabpages. Instead of instantiating a new tabcontrol, you need to loop through the tabpages of the original tabcontrol that you were working with at the beginning.

To save yourself some trouble, let the designer work for you. Simply drag and drop a tabcontrol on the page. Now, it can be accessed globally. Also, ditch that global datagridview named dgOutput. You don't need it and it shouldn't be being used. It shouldn't be being used because you create a new datagridview for each tab page that's created dynamically.

Once you get all that rewired, take a look at your code. Think about exactly what's going to happen. Right now, if that foreach loop would execute, you would only be getting data from this.dgOutput but your looping through the rows of dgv which is the datagridview on each tabpage. You want to loop through the rows of dgv to get values. You want to loop through the columns of dgv to load the headers. Then, after the headers and values are in the worksheet, you want to add it to the workbook.

Set some breakpoints within your loops and the rest of your code to debug. It'll save you alot of time and you'll learn a whole lot quicker than somebody helping you.

Lester
http://www.lestersconyers.com

QuestionHow to write a text in a video files Pin
Smithakrishnan7-Apr-08 2:16
Smithakrishnan7-Apr-08 2:16 
GeneralCustom treeview woes Pin
lsconyer7-Apr-08 2:14
lsconyer7-Apr-08 2:14 
Generalgprs Pin
sbk197-Apr-08 1:52
sbk197-Apr-08 1:52 
GeneralRe: gprs Pin
Dave Kreskowiak7-Apr-08 4:24
mveDave Kreskowiak7-Apr-08 4:24 
GeneralRe: gprs Pin
Luc Pattyn7-Apr-08 4:40
sitebuilderLuc Pattyn7-Apr-08 4:40 
GeneralRe: gprs Pin
Dave Kreskowiak7-Apr-08 6:43
mveDave Kreskowiak7-Apr-08 6:43 
GeneralProblem with merging 2 DataTables Pin
kallileo7-Apr-08 1:26
kallileo7-Apr-08 1:26 
GeneralRe: Problem with merging 2 DataTables Pin
lsconyer7-Apr-08 2:17
lsconyer7-Apr-08 2:17 
GeneralRe: Problem with merging 2 DataTables Pin
kallileo7-Apr-08 2:29
kallileo7-Apr-08 2:29 
GeneralRe: Problem with merging 2 DataTables Pin
lsconyer7-Apr-08 2:39
lsconyer7-Apr-08 2:39 
GeneralRe: Problem with merging 2 DataTables Pin
kallileo7-Apr-08 2:49
kallileo7-Apr-08 2:49 
GeneralRe: Problem with merging 2 DataTables Pin
lsconyer7-Apr-08 2:54
lsconyer7-Apr-08 2:54 
GeneralRe: Problem with merging 2 DataTables Pin
kallileo7-Apr-08 3:11
kallileo7-Apr-08 3:11 
GeneralRe: Problem with merging 2 DataTables Pin
kallileo10-Apr-08 3:20
kallileo10-Apr-08 3:20 
QuestionC#:How to load max no of records in a combobox(more than 40000) Pin
kssknov7-Apr-08 1:18
kssknov7-Apr-08 1:18 
GeneralRe: C#:How to load max no of records in a combobox(more than 40000) Pin
darkelv7-Apr-08 1:37
darkelv7-Apr-08 1:37 
GeneralRe: C#:How to load max no of records in a combobox(more than 40000) Pin
kssknov7-Apr-08 1:42
kssknov7-Apr-08 1:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.