naja, das habe ich auch schon gewusst (dritte liste). habe außerdem später auch noch fest gestellt, das englische wörter auch doppelt vorkommen.
also habe ich den folgenden code für das Eintragen verwendet:
Function Einlesen(ByVal sFile As String)
Dim intFileNo As Integer
Dim strDeutsch As String
Dim strEnglisch As String
Dim lngPos As Long ' das ist die Variable, die ich zum Speichern der
' Position des "="-Zeichens verwende
Dim strInputLine As String
Dim strValueDeu As String
Dim strValueEng As String
strValueEng = ""
strValueDeu = ""
Form1.lDeutsch.Clear
Form1.lEnglisch.Clear
intFileNo = FreeFile
Open sFile For Input As intFileNo
While Not EOF(intFileNo)
strDeutsch = ""
strEnglisch = ""
Line Input #intFileNo, strInputLine
ShowProgress picProgress, Loc(intFileNo) * 128, 0, LOF(intFileNo), True
DoEvents
lngPos = InStr(strInputLine, "=") ' alternativ denkbar wäre das Teilen des
' Strings mit der Funktion split()
If lngPos > 0 Then
If lngPos > 1 Then strDeutsch = Left$(strInputLine, lngPos - 1)
If lngPos < Len(strInputLine) Then strEnglisch = Mid$(strInputLine, lngPos _
+ 1)
' Jetzt kommt die Prüfung auf doppelte Eintragung in lDeutsch
If (strValueDeu <> strDeutsch) And (strDeutsch <> "") Then
Form1.lDeutsch.AddItem strDeutsch
strValueDeu = strDeutsch
lblDeutsch.Caption = "Lade: " & strDeutsch
End If
If (strValueEng <> strEnglisch) And (strEnglisch <> "") Then
Form1.lEnglisch.AddItem strEnglisch
strValueEng = strEnglisch
lblEnglisch.Caption = "Lade: " & strEnglisch
End If
Form1.List1.AddItem strInputLine
End If
Wend
Close intFileNo
Einlesen = True
Form1.Show
Unload Me
End Function und den folgenden code für das suchen in der dritten liste:
'Für deutschen Begriff
Private Sub lEnglisch_dblClick()
On Error Resume Next
Dim i As Integer
If lEnglisch.ListIndex >= 0 Then
Form2.lblEng(1).Visible = True
Form2.lblDeu(0).Visible = True
With lEnglisch
If .ListIndex > -1 Then
Form2.txtIst.Text = .List(.ListIndex)
Form2.txtSuch.Text = Trim(Left(List1.Text, InStr(1, List1.Text, _
"=") - 1))
End If
End With
l.Caption = "yes"
Form2.cmdCopy.Caption = "Deutsches Wort kopieren"
Form2.Show
Else
MsgBox "Kein Wort ausgewählt!", vbInformation + vbOKOnly, "Wort auswählen"
l.Caption = ""
End If
End Sub und noch des:
' für englischen Begriff
Private Sub lDeutsch_dblClick()
On Error Resume Next
Dim i As Integer
Dim sSearchFor As String
If lDeutsch.ListIndex >= 0 Then
Form2.lblDeu(1).Visible = True
Form2.lblEng(0).Visible = True
With lDeutsch
If .ListIndex > -1 Then
Form2.txtIst.Text = .List(.ListIndex)
sSearchFor = LCase(.List(.ListIndex)) & "*"
For i = 0 To List1.ListCount
If LCase(List1.List(i)) Like sSearchFor Then
Form2.txtSuch.Text = Form2.txtSuch.Text & Mid(List1.List(i), _
InStr(List1.List(i), "=") + 1) & ", "
End If
Next i
Form2.txtSuch.Text = Left(Form2.txtSuch.Text, Len( _
Form2.txtSuch.Text) - 2) 'letztes Komma und Leerzeichen wieder
' löschen
End If
End With
l.Caption = "yes"
Form2.cmdCopy.Caption = "Englisches Wort kopieren"
Form2.Show
Else
MsgBox "Kein Wort ausgewählt!", vbInformation + vbOKOnly, "Wort auswählen"
l.Caption = ""
End If
End Sub Geht ja leider nicht, aber auch nur wenn ich die richtige Wort.txt benutze (5MB) und mit der Wort_klein.txt (ca. 9 Zeilen) geht alles. |