Click here to Skip to main content
15,867,879 members

Comments by Dave Kreskowiak (Top 200 by date)

Dave Kreskowiak 3hrs ago View    
You posted this as an answer to your own question, not as a reply to me. I never got a notice that said you posted anything because of that. The only reason I'm replying is because I stumbled upon the question getting a second answer.

Sure, it works fine on your dev machine with a single user. The instant you get two users launching that code at the same time, Office will fail. Office interop does not support re-entrancy, or more than one thread using the library at the same time. The code will crash and you'll get problem reports from the users that you will not be able to replicate.

Using COM-interop is out of the question. You'll have to use a library dedicated to manipulating Excel files, like OpenXML, ClosedXML, or similar.
Dave Kreskowiak 4hrs 5mins ago View    
Not the best solution, but it would work. Using arrays of controls like that is a bit ... fragile.
Dave Kreskowiak 13hrs ago View    
That all depends on what you mean by "fine tune". I don't see much to do to this code because it doesn't do anything really useful.

My biggest complaint is each of these methods does TWO things instead of one. Showing a message box should be up to other UI code, not these methods. These methods should only build a string message and return it.
Dave Kreskowiak yesterday View    
Copy and paste the relevant code into your question, NOT AN IMAGE OF IT.
Dave Kreskowiak 2 days ago View    
No answers from ChatGPT please. It tends to get things, like code, wrong.