Answer the question
In order to leave comments, you need to log in
Why is my WPF application crashing?
Hello everyone, the essence of the question is this:
there is an application on WPF, inside the Grid there is a button responsible for generating a report in Word, but for some reason after clicking on it, the program crashes, what could be the reason?
Button code from the test application, here it is enough to open Word, but the error still occurs
private void Button_Click(object sender, RoutedEventArgs e)
{
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
Document doc = app.Documents.Add(Visible: true);
app.Documents.Open(@"C:\Users\Name\Documents\1.docx");
Console.ReadLine();
doc.Close();
app.Quit();
}
Answer the question
In order to leave comments, you need to log in
It is necessary to understand under the debugger on which line it crashes and dance from there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question