Dim WORDLIST() As String
Private Sub GetData()
Dim tW As String
Dim tmp() As String
Dim Words() As String
Open App.Path & "\arabic.txt" For Input As #1
tmp = Split(Input(LOF(1), 1), vbCrLf)
Close #1
Dim sLine As String
For x = 0 To UBound(tmp)
If UCase(Left(tmp(x), 8)) = "SOLUTION" Then
Words = Split(tmp(x), "(")
sLine = sLine & Left(Words(1), InStr(Words(1), ")") - 1) & ";"
ElseIf UCase(Left(tmp(x), 7)) = "COMMENT" Then
Words = Split(tmp(x), ":")
sLine = sLine & Words(1)
ElseIf UCase(Left(tmp(x), 5)) = "INPUT" Then
If sLine <> "" Then
If Right(sLine, 1) = ";" Then
sLine = Left(sLine, Len(sLine) - 1)
End If
sLine = sLine & vbCrLf
End If
Words = Split(tmp(x), ":")
sLine = sLine & Trim(Words(1)) & ":"
ElseIf UCase(Left(tmp(x), 7)) = "LOOK-UP" Then
'nothing
End If
Next
Debug.Print sLine
WORDLIST = Split(sLine, vbCrLf)
End Sub
Private Sub Form_Load()
GetData
RichTextBox1.Text = "not sure what to put here...."
End Sub
Private Sub mnuWord_Click(Index As Integer)
If InStr(mnuWord(Index).Caption, "NOT FOUND") = 0 Then
RichTextBox1.SelText = mnuWord(Index).Caption
End If
End Sub
Private Sub RichTextBox1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 Then
Dim sLoc As Integer, eLoc As Integer
Dim wrds() As String
Dim tmp() As String
If Trim(RichTextBox1.SelText) = "" Then
If RichTextBox1.SelStart = 0 Then Exit Sub
sLoc = InStrRev(RichTextBox1.Text, " ", RichTextBox1.SelStart)
eLoc = InStr(RichTextBox1.SelStart, RichTextBox1.Text, " ") - 1
RichTextBox1.SelStart = sLoc
RichTextBox1.SelLength = eLoc - sLoc
End If
If Trim(RichTextBox1.SelText) <> "" Then
For x = mnuWord.UBound To 1 Step -1
Unload mnuWord(x)
Next
mnuWord(0).Caption = "NOT FOUND"
For x = 0 To UBound(WORDLIST)
tmp = Split(WORDLIST(x), ":")
If tmp(0) = Trim(RichTextBox1.SelText) Then
wrds = Split(tmp(1), ";")
For I = 0 To UBound(wrds)
If I = 0 Then
mnuWord(0).Caption = wrds(I)
Else
Load mnuWord(I)
mnuWord(I).Visible = True
mnuWord(I).Caption = wrds(I)
End If
Next
End If
Next
PopupMenu mnuPop
End If
End If
End Sub