c# - System.Windows.Window.Activate() cannot implement Microsoft.Office.Interop.Word.Window.Activate() because it does not have the matching return type? -
//error occurred @ line 1:cannot implement'microsoft.office.interop.word.window.activate()' //because not have matching return type of 'void'. //someone me fix error
public partial class window1 : window { public window1() { initializecomponent(); } private void btnselectword_click(object sender, routedeventargs e) { // initialize openfiledialog openfiledialog openfiledialog = new openfiledialog(); // set filter , restoredirectory openfiledialog.restoredirectory = true; openfiledialog.filter = "word documents(*.doc;*.docx)|*.doc;*.docx"; bool? result = openfiledialog.showdialog(); if (result == true) { if (openfiledialog.filename.length > 0) { txbselectedwordfile.text = openfiledialog.filename; } } }
this problem can caused 2 namespaces microsoft.office.interop.word
, system.windows
. try following compiler choose correct type:
public partial class window1 : system.windows.window
Comments
Post a Comment