Click here to Skip to main content
15,890,506 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to code a editor Pin
Christian Graus8-Apr-08 19:13
protectorChristian Graus8-Apr-08 19:13 
GeneralRe: How to code a editor Pin
N a v a n e e t h8-Apr-08 19:45
N a v a n e e t h8-Apr-08 19:45 
QuestionFile System Security Pin
M. J. Jaya Chitra8-Apr-08 18:10
M. J. Jaya Chitra8-Apr-08 18:10 
QuestionHow set set Font-Size for Gridview that affects all control in the gridview? Pin
blooper028-Apr-08 17:33
blooper028-Apr-08 17:33 
Questionhow to move object in richtextbox using mouse event Pin
kamalesh57438-Apr-08 16:44
kamalesh57438-Apr-08 16:44 
QuestionHow to split a string into 2 variables. Pin
Joshua1233218-Apr-08 16:13
Joshua1233218-Apr-08 16:13 
AnswerRe: How to split a string into 2 variables. Pin
PIEBALDconsult8-Apr-08 16:34
mvePIEBALDconsult8-Apr-08 16:34 
AnswerRe: How to split a string into 2 variables. Pin
Christian Graus8-Apr-08 17:01
protectorChristian Graus8-Apr-08 17:01 
GeneralValidating form field for HTML tags but Anchor text Pin
JohnyCoder8-Apr-08 16:02
JohnyCoder8-Apr-08 16:02 
GeneralAutomatically mapping printers... Pin
Jacob Dixon8-Apr-08 15:57
Jacob Dixon8-Apr-08 15:57 
GeneralTCP/IP Sockets Pin
#realJSOP8-Apr-08 11:25
mve#realJSOP8-Apr-08 11:25 
GeneralRe: TCP/IP Sockets Pin
Ravenet8-Apr-08 16:01
Ravenet8-Apr-08 16:01 
QuestionUpdating Child Table's Key (almost have it) Pin
MaxRelaxman8-Apr-08 10:58
MaxRelaxman8-Apr-08 10:58 
GeneralSimple C # Solution Help Pin
Hulicat8-Apr-08 9:39
Hulicat8-Apr-08 9:39 
GeneralRe: Simple C # Solution Help Pin
pmarfleet8-Apr-08 11:15
pmarfleet8-Apr-08 11:15 
GeneralRe: Simple C # Solution Help Pin
Hulicat8-Apr-08 11:42
Hulicat8-Apr-08 11:42 
GeneralRe: Simple C # Solution Help Pin
Ravenet8-Apr-08 16:02
Ravenet8-Apr-08 16:02 
GeneralCalling a ASP.NET C# function from javascript Pin
Matt Cavanagh8-Apr-08 9:27
Matt Cavanagh8-Apr-08 9:27 
GeneralRe: Calling a ASP.NET C# function from javascript Pin
Pete O'Hanlon8-Apr-08 9:49
mvePete O'Hanlon8-Apr-08 9:49 
GeneralRe: Calling a ASP.NET C# function from javascript Pin
nelo_8-Apr-08 14:20
nelo_8-Apr-08 14:20 
GeneralExport DataGrid from different dynamically created tabpages to multiple worksheets of an Excel spreasheet Pin
Walaza8-Apr-08 7:09
Walaza8-Apr-08 7:09 
The code I have below only takes data from one dynamically created tabpage (the default)‘s datagrid and exports it to a spreadsheet. I would like the application to take the data from all the dynamically created tabpages’ datagrids and export the data to excel and create a new worksheet for each tabpage as it is exporting. Please help.

Microsoft.Office.Interop.Excel._Application _appClass = new ApplicationClass();
_appClass.Visible = true;

_appClass.Caption = "Exported ECS Errors";

Microsoft.Office.Interop.Excel.Workbook wbk = _appClass.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);

Worksheet obj = (Worksheet)wbk.ActiveSheet;

// get the collection of sheets in the workbook
Microsoft.Office.Interop.Excel.Sheets sheets = wbk.Worksheets;

Range r = (Range)obj.Cells;

try
{
//Load the Headers and make them BOLD
for (int i = 0; i < ((DataGridView)this.dgOutput).Columns.Count; i++)
{
r[1, i + 1] = ((DataGridView)this.dgOutput).Columns[i].HeaderText.ToString();
((Range)r.Cells[1, i + 1]).Font.Bold = true;
}

//Load the data from the datagrid to the new spreadsheet
for (int i = 1; i < ((DataGridView)this.dgOutput).Rows.Count - 1; i++)
{
for (int j = 0; j < ((DataGridView)this.dgOutput).Columns.Count; j++)
{
r[i + 1, j + 1] = ((DataGridView)this.dgOutput).Rows[i].Cells[j].Value.ToString();

//Do the colors
if (((DataGridView)this.dgOutput).Rows[i].Cells[j].Value.ToString() == "Update OK")
{
((Range)r.Cells[i + 1, 1]).Font.Color = Color.Green.G;
}
}
}
}
catch (Exception EX) //user closes the Excel file while it is loading data from the datagrid
{
MessageBox.Show(EX.Message + "The Excel file was closed while loading data from the datagrid.",
"Error : Loading file!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

Mvelo Walaza
Developer
Telkom SA

Generalproblems rightformating [modified] Pin
stephan_0078-Apr-08 6:24
stephan_0078-Apr-08 6:24 
GeneralRe: problems rightformating Pin
Luc Pattyn8-Apr-08 6:42
sitebuilderLuc Pattyn8-Apr-08 6:42 
GeneralRe: problems rightformating Pin
stephan_0078-Apr-08 10:03
stephan_0078-Apr-08 10:03 
GeneralChecking integer values and adding same types together Pin
Sharkadder8-Apr-08 6:23
Sharkadder8-Apr-08 6:23 

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.