Private
Sub Form_Load()
'object
Set wn = CreateObject("Wordnet.Wordnet.2")
wn.wninit
'populate pos combobox
For i = WN_FIRSTPOS To WN_LASTPOS Step 1
pos.AddItem (wn.posname(i))
Next i
pos.ListIndex = WN_NOUN - WN_FIRSTPOS
'populate link combobox
For i = WN_FIRSTLINKTYPE To WN_MAXLINKTYPE Step 1
linktype.AddItem (wn.linktypename(i))
Next i
linktype.ListIndex = WN_OVERVIEW - WN_FIRSTLINKTYPE
End Sub
Private Sub Form_Unload(Cancel As
Integer)
Set wn = Nothing
End Sub
Private Sub lookup_Click()
thisword = word.Text
thispos = pos.ListIndex + WN_FIRSTPOS
thislinktype = linktype.ListIndex + WN_FIRSTLINKTYPE
If recurse.Value = 1 Then
thislinktype = -thislinktype
End If
'search
Dim thisoutput As String
thisoutput = wn.findtheinfo(thisword, thispos, thislinktype,
WN_ALLSENSES)
'display
output.Text = ""
Dim thissubstring As String
Dim thischar As Integer
Dim i, j As Integer
j = 1
For i = 1 To Len(thisoutput) Step 1
thissubstring = Mid(thisoutput, i, 1)
thischar = Asc(thissubstring)
If thischar = 10 Then
thissubstring = Chr(13) + Chr(10) +
Mid(thisoutput, j, i - j)
output.SelStart = Len(output.Text)
output.SelText = thissubstring
j = i + 1
End If
Next i
output.SelStart = Len(output.Text)
output.SelText = Chr(13) + Chr(10)
End Sub |