Click here to Skip to main content
15,794,593 members
Home / Discussions / C#
   

C#

 
GeneralRe: Changing the properties of multiple labels in some kind of loop? Pin
Ron_UK16-Nov-20 6:19
Ron_UK16-Nov-20 6:19 
GeneralRe: Changing the properties of multiple labels in some kind of loop? Pin
OriginalGriff16-Nov-20 6:27
mvaOriginalGriff16-Nov-20 6:27 
GeneralRe: Changing the properties of multiple labels in some kind of loop? Pin
Ron_UK16-Nov-20 9:39
Ron_UK16-Nov-20 9:39 
GeneralRe: Changing the properties of multiple labels in some kind of loop? Pin
OriginalGriff16-Nov-20 10:29
mvaOriginalGriff16-Nov-20 10:29 
AnswerRe: Changing the properties of multiple labels in some kind of loop? Pin
Luc Pattyn16-Nov-20 6:30
sitebuilderLuc Pattyn16-Nov-20 6:30 
GeneralRe: Changing the properties of multiple labels in some kind of loop? Pin
Ron_UK16-Nov-20 6:40
Ron_UK16-Nov-20 6:40 
AnswerRe: Changing the properties of multiple labels in some kind of loop? Pin
Gerry Schmitz16-Nov-20 8:13
mveGerry Schmitz16-Nov-20 8:13 
QuestionHow to make a dll library? Pin
Alex Dunlop16-Nov-20 1:22
Alex Dunlop16-Nov-20 1:22 
I have wrote some lines of code for exporting DataGridView contents to Excel file. The code works fine in the main Form. I want to make a class (.dll file) from my code so I could use it as reference in many projects. How is it possible?
My code is:
C#
private void btnExport_Click(object sender, EventArgs e)
       {
           Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application();
           Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing);
           Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
           worksheet = workbook.Sheets["Sheet1"];
           worksheet = workbook.ActiveSheet;
           worksheet.Name = "pmInfo";
           for (int i = 1; i < dataGridView1.Columns.Count+1; i++)
           {
               worksheet.Cells[1, i] = dataGridView1.Columns[i - 1].HeaderText;
           }
           for (int i = 0; i < dataGridView1.Rows.Count; i++)
           {
               for (int j = 0; j < dataGridView1.Columns.Count; j++)
               {
                   worksheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString();
               }
           }
           var saveFileDialoge = new SaveFileDialog();
           saveFileDialoge.FileName = "Output";
           saveFileDialoge.DefaultExt = ".xlsx";
           if (saveFileDialoge.ShowDialog()==DialogResult.OK)
           {
               workbook.SaveAs(saveFileDialoge.FileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

           }
       }

AnswerRe: How to make a dll library? Pin
Richard MacCutchan16-Nov-20 1:44
mveRichard MacCutchan16-Nov-20 1:44 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 1:47
Alex Dunlop16-Nov-20 1:47 
GeneralRe: How to make a dll library? Pin
Richard MacCutchan16-Nov-20 1:51
mveRichard MacCutchan16-Nov-20 1:51 
AnswerRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 1:50
mvaOriginalGriff16-Nov-20 1:50 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 2:51
Alex Dunlop16-Nov-20 2:51 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 3:17
mvaOriginalGriff16-Nov-20 3:17 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 3:25
Alex Dunlop16-Nov-20 3:25 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 3:41
mvaOriginalGriff16-Nov-20 3:41 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 3:48
Alex Dunlop16-Nov-20 3:48 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 3:50
mvaOriginalGriff16-Nov-20 3:50 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 4:09
Alex Dunlop16-Nov-20 4:09 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 4:40
mvaOriginalGriff16-Nov-20 4:40 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 5:15
Alex Dunlop16-Nov-20 5:15 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 5:37
mvaOriginalGriff16-Nov-20 5:37 
GeneralMessage Closed Pin
16-Nov-20 6:23
Alex Dunlop16-Nov-20 6:23 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 6:41
mvaOriginalGriff16-Nov-20 6:41 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 3:21
mvaOriginalGriff16-Nov-20 3:21 

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.