Results 1 to 10 of 10

Thread: Code help Again

  1. #1

    Thread Starter
    Lively Member Jamiex's Avatar
    Join Date
    Sep 2007
    Location
    Scotland, UK
    Posts
    116

    Code help Again

    sorry i should have added this in my last post but i forgot to.

    My question is i have txtBoxes and a form that has PASS and FAIL buttons.

    What i want is my program to remember what the user enters into the txtBoxes and if he presses the PASS or FAIL buttons. And on the last Form if they press the SAVE button my program should open up notepad and copy all the entered text to notepad and bring up notepads save window. And if they press the PRINT button on my program it should open up notepad add all the text and automatically print it (can that be done).

    Thanks

    Jamie

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Code help Again

    Why would you want that.. you can make your program do all of that itself..

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Code help Again

    Quote Originally Posted by Jamiex
    What i want is my program to remember what the user enters into the txtBoxes and if he presses the PASS or FAIL buttons.
    Are you familiar with writing to, and reading from, text files?

  4. #4

    Thread Starter
    Lively Member Jamiex's Avatar
    Join Date
    Sep 2007
    Location
    Scotland, UK
    Posts
    116

    Re: Code help Again

    em....no im not familiar with that sorry

  5. #5
    Addicted Member Vanasha's Avatar
    Join Date
    Jun 2007
    Location
    In a bin.>_>
    Posts
    152

    Re: Code help Again

    This is just the basic idea of writing and reading to a text file.
    vb Code:
    1. On Error Resume Next
    2. Dim FF As Integer
    3. FF = FreeFile()
    4. Dim FileData As String
    5. Open App.Path & "\Info.txt" For Input As #FF
    6.     FileData = Input(LOF(FF), FF)
    7. Close #FF
    8.  
    9. Open App.Path & "\Info.txt" For Append As #FF
    10.     Print #FF, "I am writing to a file."
    11. Close #FF

    For more information search google. Or highlight the word "Open" in visual basic and press F1.
    Quote Originally Posted by Vanasha
    Sorry, i'm slow.


  6. #6

    Thread Starter
    Lively Member Jamiex's Avatar
    Join Date
    Sep 2007
    Location
    Scotland, UK
    Posts
    116

    Re: Code help Again

    cool thanks

    Actually could you maybe explain how this code works and also do i just put this in the code for all the text boxes or what.

    Thanks for the help

    Jamie
    Last edited by Jamiex; Sep 10th, 2007 at 10:33 AM.

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Code help Again

    How many textboxs are we talking about?

  8. #8

    Thread Starter
    Lively Member Jamiex's Avatar
    Join Date
    Sep 2007
    Location
    Scotland, UK
    Posts
    116

    Re: Code help Again

    3 textboxes and two buttons one being Pass and one being Fail. Two of the textboxes are on one form and the other is on another form and the two buttons are on another form but are together. The results from the text boxes and what button was pressed is to go into the .txt

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Code help Again

    Try (from the second form)
    Code:
    Private Sub cmdSave_Click()
    Open "c:\jamiex.txt" For Append As #1
    Print #1, Form1.Text1.Text & vbCrLf
    Print #1, Form1.Text2.Text & vbCrLf
    Print #1, Text3.Text
    Close #1
    End Sub
    Change the name of the textboxs and form to conform to what you are using in your project.

  10. #10

    Thread Starter
    Lively Member Jamiex's Avatar
    Join Date
    Sep 2007
    Location
    Scotland, UK
    Posts
    116

    Re: Code help Again

    Is there anyway of telling it to print the file if a print button is pressed as the results might be needed to be printed to paper.

    also (sorry to keep going on) can i let the user pick the name of the file that will be saved and how do i tell it to save the Pass or Fail button depending on which button is pressed
    Thanks

    Jamie
    Last edited by Jamiex; Sep 12th, 2007 at 11:56 AM.

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