عملت هذا البرنامج و هو استخدام المدقق الإملائي الخاص ببرنامج الورد و لا يوجد أي
syntax Error
لكن يبدو أن هناك
Run time error
هل من مساعد ؟؟؟
//-----------------------------------------------------------------------------------------
Dim i, j As Integer//global variable
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Private Sub btnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click
Dim TheText, filename As String
Dim Data As StreamReader
filename = Application.StartupPath + "\The_Text.txt"
Data = New StreamReader(filename)
TheText = Data.ReadToEnd
Me.txtTheText.Text = TheText
End Sub
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Private Sub btnSpellCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpellCheck.Click
Dim wordApp As New Word.Application
Dim DRange As word.range
wordApp.Document.Add()
DRange.insertAfter(Me.txtTheText.Text)
Dim spellCollection As word.proofreadingErrors
spellCollection = DRange.spellingErrors
For i = 0 To spellCollection.count - 1
Me.lstError.Items.Add(spellCollection.item(i).text)
Next
End Sub
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Private Sub btnReplace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReplace.Click
Dim CorrectionCollection As word.spellingsuggestions
Dim spellCollection As word.proofreadingErrors
i = Me.lstError.SelectedIndex
j = Me.lstCorrection.SelectedIndex
Replace(Me.txtTheText.Text, Me.lstError.SelectedItems(i), Me.lstCorrection.SelectedItems(j))
End Sub
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Private Sub lstError_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstError.SelectedIndexChanged
Dim wordApp As New Word.Application
Dim CorrectionCollection As word.spellingsuggestions
CorrectionCollection = wordApp.getspellingsugestions(Me.lstError.Text)
For i = 0 To CorrectionCollection.count - 1
Me.lstCorrection.Items.Add(CorrectionCollection.item(i).text)
Next
End Sub
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////