[求助]各位寻求帮助!
各位大虾,偶是初学者,我在编程时想利用openfiledialog打开Word文档,但不知如何实现?请指点,以下是偶的编程:
Private Sub btnopen_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnopen.Click
With OpenFileDialog1 'set the open dialog properties
.Filter = "text files(*.txt)|*.txt|all files(*.*)|*.*"
.FilterIndex = 1
.InitialDirectory = "c:\documents and settings\phenixbb\桌面"
.Title = "demo open file dialog"
End With
'show the open dialog and if the user clicks the OK button,load the file
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
strfilename = OpenFileDialog1.FileName
Dim objreader As StreamReader = New StreamReader(strfilename)
txtfile.Text = objreader.ReadToEnd()
objreader.Close()
objreader = Nothing
rtbfile.LoadFile(strfilename, RichTextBoxStreamType.PlainText)
End If
End Sub
谢谢!