Results 1 to 5 of 5

Thread: help with coding...Resolved

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    7

    help with coding...Resolved

    hi, i am trying to create a new program, so when the user hit the search button, it will compare the input with a text file, and if it find the name in the text file, it will open up a new text file and print out more information related to the name it found in the fist text file.

    so for example, i search for visual basic, the program will open up the 1st text file and search for that name (visual basic), if it match, it will open the 2nd text file, and find (visual basic, and the 2nd file will include all information about visual basic) and print out the result.

    so can you make up an example code for how that work? because i know that's what i want my program to do, but have no idea what the coding structure is like.
    thanks
    Last edited by qdv; Jun 18th, 2003 at 10:20 PM.

  2. #2
    Hyperactive Member
    Join Date
    Aug 2002
    Posts
    416
    I have no idea what you want to do :\

  3. #3
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    VB Code:
    1. Dim SearchString as STring
    2. dim filec as string
    3.  
    4. SearchString = "Visual Basic"
    5.  
    6.  
    7. open "C:\text1.txt" for input as #1
    8. filec = input(lof(1),1)
    9. close #1
    10.  
    11. if instr(filec,searchstring) then
    12. open "C:\text2.txt" for input as #1
    13. filec=input(lof(1),1)
    14. close #2
    15.  
    16. 'then do whatever after you opened the second file
    17.  
    18. end if
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    7

    ...

    ohh ok, so I should use the If statement for the 2nd file, but is there a way I can load the two text files in form_load first?

  5. #5
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    ?

    then load them in form load. nothing will go wrong. just don't close them. ie

    form load:

    open filename for input as #1
    open filename2 for input as #2

    then in your other sub

    file1 = input(lof(1),1)
    file2 = input(lof(2),2)

    and when you exit you should

    close #1
    close #2
    Remember, if someone's post was not helpful, you can always rate their post negatively .

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