Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2004
    Posts
    23

    Unanswered: how to open notepad?

    I have a VB application.. how do i make the command button open up a notepad to print certain numbers created from the VB application?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Do you just want to print the numbers, or do you actually want to open notepad? These are two different actions, and I'd use fundamentally different ways to do each of them.

    -PatP

  3. #3
    Join Date
    Jun 2004
    Posts
    23
    hmm .. when user click the button .. it will print the number on the notepad .. yeah so its print the number

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I'm sorry, but I don't understand what you want. Maybe someone else can help.

    -PatP

  5. #5
    Join Date
    Nov 2004
    Posts
    108
    if you want to store your results for some reason in a txt file you can just use
    I/O commands

    Open...
    write...
    Close...

    and if you want the user to see the results you can use

    shell

  6. #6
    Join Date
    Jun 2004
    Posts
    23
    I have 2 labels, Label 1 and Label 3.

    When this 2 labels are drag and drop onto Label 2, their co-ordinates will appear in the label, Status.

    Everything above is fine. I get the coordinates at the Status label. I then inserted a Command Button so that when the user click on it, a notepad will print the co-ordinates. But I didn't manage to open the notepad when i click on the button.

    Anyone can help?

    Code:
    Private Sub Command1_Click()
    
    Dim Source As Integer
    
    Source = FreeFile
    
    Open "Output.txt" For Output As #Source
    
    Write #Source; << -- error here  
    
    Close #Source
    
    End Sub
    Code:
    Private Sub Label2_DragDrop(Source As Control, X As Single, Y As Single)
     Source.Move X - MouseX, Y - MouseY
    Status.Caption = "dropped on label 2, x=" & X & " y = " & Y
     End Sub

  7. #7
    Join Date
    Jan 2004
    Location
    Aberdeen, Scotland
    Posts
    1,067
    You havent declared what you are writing to the file,

    Write #Source; << -- error here
    something like Write #Source Status.caption

    After your Code for command1 you have written a textfile, which can then be opened in notepad etc. which you can use the shell command to open

  8. #8
    Join Date
    Nov 2004
    Posts
    108

    Wink sometimes simple is better

    why don't you display the resust in a label or picture box and if the user wants then printed directly to the printer

    Code:
    printer.print labelCord.caption

  9. #9
    Join Date
    Nov 2004
    Posts
    108

    Cool Open, Write/Print, Close

    Code:
    Open "TESTFILE" For Output As #1   ' Open file for output.
    Write #1, cstr(x) & "," & cstr(y)    'Write some values
    Close #1   ' Close file.
    or

    Code:
    Open "TESTFILE" For Output As #1   ' Open file for output.
    Print #1, "This is a test"   ' Print text to file.
    Close #1   ' Close file.

Posting Permissions

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