i have an notepad files, i want to make a listbox and add the notepad files there and that when you click on one it will show the text in a text box how can i do that?
Printable View
i have an notepad files, i want to make a listbox and add the notepad files there and that when you click on one it will show the text in a text box how can i do that?
throw a rtf text box onto the form, on the click event of the list box parse the file and gooi it into the rtf box.
i'll leave the parsing code to u ;)
i dont know what u mean could someone help me?
Try this.
VB Code:
Private m_FilePath As String Private Sub LoadFilesInListBox(sDir As String) Dim sFile As String If Right$(sDir, 1) <> "\" Then sDir = sDir & "\" m_FilePath = sDir sFile = Dir$(sDir & "*.*") Do While Len(sFile) > 0 If UCase$(Right$(sFile, "3")) = "TXT" Then List1.AddItem sFile sFile = Dir Loop End Sub Private Sub Command1_Click() LoadFilesInListBox "C:\windows" End Sub Private Sub List1_DblClick() Open m_FilePath & "\" & List1.List(List1.ListIndex) For Input As #1 Text1 = Input(LOF(1), 1) Close #1 End Sub