Click here to Skip to main content
14,774,712 members
Home » Discussions » C#
   

C#

 
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
MemberRon_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
MemberAlex Dunlop16-Nov-20 1:22 
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
MemberAlex 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
mveOriginalGriff16-Nov-20 1:50 
First, make it as generic as possible: instead of writing it as an Event handler which works with a specific DataGridView and Sheet make it a generic routine that takes several parameters: The data source, the Sheet name, and the file path to write to. You call that generic method from your handler.
Ideally, you shouldn't pass a control like a DGV, but the underlying datasource it uses instead. You can access the properties from that quite easily - this shows you how: Converting a List to a DataTable[^]

You should not be using a dialog in a dll, as there is no guarantee that the calling application will be running under windows - it potentially could be a web app or on a server, where the user can't see a SaveFileDialog, and shouldn't have access to the file system anyway.

Then create a new Project as a ClassLibrary and move your method into it.
Add a reference (and using statement if necessary) to the library to your original project, and you can call it from there.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 2:51
MemberAlex Dunlop16-Nov-20 2:51 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 3:17
mveOriginalGriff16-Nov-20 3:17 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 3:25
MemberAlex Dunlop16-Nov-20 3:25 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 3:41
mveOriginalGriff16-Nov-20 3:41 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 3:48
MemberAlex Dunlop16-Nov-20 3:48 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 3:50
mveOriginalGriff16-Nov-20 3:50 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 4:09
MemberAlex Dunlop16-Nov-20 4:09 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 4:40
mveOriginalGriff16-Nov-20 4:40 
GeneralRe: How to make a dll library? Pin
Alex Dunlop16-Nov-20 5:15
MemberAlex Dunlop16-Nov-20 5:15 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 5:37
mveOriginalGriff16-Nov-20 5:37 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 6:41
mveOriginalGriff16-Nov-20 6:41 
GeneralRe: How to make a dll library? Pin
OriginalGriff16-Nov-20 3:21
mveOriginalGriff16-Nov-20 3:21 
QuestionC# WPF MenuItem Control not working Pin
Member 783087415-Nov-20 10:01
MemberMember 783087415-Nov-20 10:01 
AnswerRe: C# WPF MenuItem Control not working Pin
Mycroft Holmes15-Nov-20 12:03
professionalMycroft Holmes15-Nov-20 12:03 
GeneralRe: C# WPF MenuItem Control not working Pin
Member 783087417-Nov-20 15:51
MemberMember 783087417-Nov-20 15:51 
QuestionHow to group an array list, within a list of records, Linq GroupBy Pin
jkirkerx14-Nov-20 14:29
professionaljkirkerx14-Nov-20 14:29 
AnswerRe: How to group an array list, within a list of records, Linq GroupBy Pin
Gerry Schmitz14-Nov-20 23:31
mveGerry Schmitz14-Nov-20 23:31 

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.