Sådan læser du en tekst fil, linje for linje og tilføjer linjerne til en combobox og åbner en selected sti fra en combobox.
*****************************************************
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private sub Form_load()
Dim Sti as string, Linje as string
Sti = app.path & "\\spil.txt" ' Vejen til din txt fil
Open sti for input as #1 ' Åbner txt filen
Do Until EOF(1)
Line Input #1, Linje
ComboBox1.additem Linje ' Tilføjer den læste Linje til Combo
Loop
Close #1
End Sub
Private sub Command1_click()
Dim Selected as string ' Den selected item i Combobox1
Selected = Combobox1.list(Combobox1.listindex)
ShellExecute frmMain.hWnd, "open", Selected, vbNullString, vbNullString, "5" 'åbner spillet
End sub
*****************************************************
Håber det hjalp =)
Mhv Simon -
http://OmniCalc.starthotel.dk