• Want to take part in this year's BoS Trials event for Maths and/or Business Studies?
    Click here for details and register now!
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page

Loading text file and Printing in VB6 (URGENT!) (1 Viewer)

Trent566

New Member
Joined
Mar 12, 2004
Messages
15
Gender
Undisclosed
HSC
N/A
G'day all, Im working on my sdd VB6 project. I need to open a text file in my program but I don't know the coding of it.

I've tried:
Open App.Path & "C:\ReadMe.txt" For Input As #1

Open “C:\ReadMe.txt” For Output As #1

Open “C:\ReadMe.txt”

Load “C:\ReadMe.txt”

But none of them works

Also I need to print the objects on the frame, i've tried the following codes:

Printer.Print frmYear12T.Frame1

Printer.Print frmYear12T.Fram1.Appearence

Printer.Print frmYear12T.Frame1.Visible

Printer.Print frmYear12T.Frame1.Container


But again none of them works :(

Can someone please help me of the coding? Thanks in advance.

Trent
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Code:
Option Explicit

Private Sub Form_Load()

  Dim test1 As String
  Dim test2 As String
  Dim temp As String
  
  Open "c:\test.txt" For Input As #1
  
    ' read one line at a time
    Line Input #1, test1
    
    MsgBox test1
    
    ' read one character at a time until the end of file
    Do While (Not EOF(1))
      temp = Input(1, #1)
      test2 = test2 + temp
    Loop
    
    MsgBox test2
    
  Close #1
        
End Sub
If you only want to print the frame inside a form, I suggest you make a copy of the frame on a new borderless form that do form.PrintForm on that new form instead.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top