Click here to Skip to main content
15,916,412 members
Home / Discussions / C#
   

C#

 
QuestionHelp with Docker Pin
pkfox18-Nov-20 20:30
professionalpkfox18-Nov-20 20:30 
AnswerRe: Help with Docker Pin
Gerry Schmitz19-Nov-20 4:26
mveGerry Schmitz19-Nov-20 4:26 
GeneralRe: Help with Docker Pin
pkfox19-Nov-20 4:28
professionalpkfox19-Nov-20 4:28 
GeneralRe: Help with Docker Pin
Pete O'Hanlon19-Nov-20 4:39
mvePete O'Hanlon19-Nov-20 4:39 
GeneralRe: Help with Docker Pin
pkfox19-Nov-20 6:49
professionalpkfox19-Nov-20 6:49 
QuestionHow to save DataGridView content? Pin
Alex Dunlop17-Nov-20 21:35
Alex Dunlop17-Nov-20 21:35 
AnswerRe: How to save DataGridView content? Pin
Richard Deeming17-Nov-20 21:39
mveRichard Deeming17-Nov-20 21:39 
AnswerRe: How to save DataGridView content? Pin
OriginalGriff17-Nov-20 21:49
mveOriginalGriff17-Nov-20 21:49 
Quote:
The save file should be addressed where the main EXE file exists

No, it shouldn't.
That's a rookie mistake: it works in development but fails in production because the EXE file is stored under a subdirectory of "Program Files" and that folder is protected by default to prevent or at least reduce virus activity. So when you app truies to write a new version, it can't and you app fails. See here: Where should I store my data?[^] for some better ideas.

Actually restoring the data isn't complicated: read the Excel file and load the DGV in the Form Load or Show event. Stroe the path to the Excel data in teh EXE config file, and you can save and restore it to the same place.

But you are still using the DGV directly, instead of the underlying data which is a mistake.
As I explained last time, your DLL based "write to Excel" code needs to be passed something, and a DataTable is much better than a DGV - so add code in that assembly to read it back out and into a DataTable. Then return the DT and your EXE can use that as the source for your DGV.
It really does make life eaiser, even if it means you making small changes to existing code!
"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 save DataGridView content? Pin
Alex Dunlop18-Nov-20 6:05
Alex Dunlop18-Nov-20 6:05 
GeneralRe: How to save DataGridView content? Pin
OriginalGriff18-Nov-20 6:21
mveOriginalGriff18-Nov-20 6:21 
GeneralRe: How to save DataGridView content? Pin
Alex Dunlop18-Nov-20 6:05
Alex Dunlop18-Nov-20 6:05 
GeneralRe: How to save DataGridView content? Pin
Mycroft Holmes18-Nov-20 11:14
professionalMycroft Holmes18-Nov-20 11:14 
Question.NET5 publish selfcontained: issue with App.config Pin
Super Lloyd17-Nov-20 14:31
Super Lloyd17-Nov-20 14:31 
AnswerRe: .NET5 publish selfcontained: issue with App.config Pin
Richard Deeming17-Nov-20 17:46
mveRichard Deeming17-Nov-20 17:46 
GeneralRe: .NET5 publish selfcontained: issue with App.config Pin
Super Lloyd17-Nov-20 18:12
Super Lloyd17-Nov-20 18:12 
AnswerRe: .NET5 publish selfcontained: issue with App.config Pin
Gerry Schmitz17-Nov-20 20:46
mveGerry Schmitz17-Nov-20 20:46 
GeneralRe: .NET5 publish selfcontained: issue with App.config Pin
Super Lloyd17-Nov-20 20:52
Super Lloyd17-Nov-20 20:52 
GeneralRe: .NET5 publish selfcontained: issue with App.config Pin
Gerry Schmitz17-Nov-20 20:59
mveGerry Schmitz17-Nov-20 20:59 
GeneralRe: .NET5 publish selfcontained: issue with App.config Pin
Super Lloyd17-Nov-20 21:16
Super Lloyd17-Nov-20 21:16 
GeneralRe: .NET5 publish selfcontained: issue with App.config Pin
Gerry Schmitz18-Nov-20 7:05
mveGerry Schmitz18-Nov-20 7:05 
QuestionHow to reference resource from Resources file Pin
Bootzilla3316-Nov-20 13:56
Bootzilla3316-Nov-20 13:56 
AnswerRe: How to reference resource from Resources file Pin
Richard Deeming16-Nov-20 21:45
mveRichard Deeming16-Nov-20 21:45 
GeneralRe: How to reference resource from Resources file Pin
Bootzilla3317-Nov-20 4:27
Bootzilla3317-Nov-20 4:27 
GeneralRe: How to reference resource from Resources file Pin
Richard Deeming17-Nov-20 4:30
mveRichard Deeming17-Nov-20 4:30 
QuestionVariable for number of days Pin
Member 1447460716-Nov-20 5:56
Member 1447460716-Nov-20 5:56 

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.