Results 1 to 4 of 4

Thread: HeLp!!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    Disney Land
    Posts
    190

    Question HeLp!!

    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?

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2002
    Location
    Disney Land
    Posts
    190
    i dont know what u mean could someone help me?

  4. #4
    Megatron
    Guest
    Try this.
    VB Code:
    1. Private m_FilePath As String
    2.  
    3. Private Sub LoadFilesInListBox(sDir As String)
    4.     Dim sFile As String
    5.    
    6.     If Right$(sDir, 1) <> "\" Then sDir = sDir & "\"
    7.     m_FilePath = sDir
    8.    
    9.     sFile = Dir$(sDir & "*.*")
    10.     Do While Len(sFile) > 0
    11.         If UCase$(Right$(sFile, "3")) = "TXT" Then List1.AddItem sFile
    12.         sFile = Dir
    13.     Loop
    14. End Sub
    15.  
    16. Private Sub Command1_Click()
    17.     LoadFilesInListBox "C:\windows"
    18. End Sub
    19.  
    20. Private Sub List1_DblClick()
    21.     Open m_FilePath & "\" & List1.List(List1.ListIndex) For Input As #1
    22.     Text1 = Input(LOF(1), 1)
    23.     Close #1
    24. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width