File input help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • halo combat22
    New Member
    • Oct 2007
    • 24

    File input help

    I use VB6.
    Code:
    Dim nnumber As Integer: Dim sName As String
    Private Sub Command1_Click()
    Open "input1.txt" For Input As 1
        Do Until EOF(1)
            Input #1, sName, nnumber
            List1.AddItem sName
        Loop
    End Sub
    Private Sub List1_Click()
        Picture1.Print nnumber
    End Sub
    I am trying to get the output user's total to a picturebox when they click on a listbox.

    My input file goes as following
    Code:
    Bob
    200
    Mike
    232
    Dick
    2322
  • Torgg
    New Member
    • Dec 2007
    • 41

    #2
    Give this a try

    Code:
        
    Private Sub List1_Click()    
        Dim objPrint As Object
        Set objPrint = Picture1
        objPrint.Font.Name = "Arial"
        objPrint.FontSize = "10"
        
        objPrint.Print "123456 TEST"
    End Sub
    Torgg

    Comment

    • halo combat22
      New Member
      • Oct 2007
      • 24

      #3
      I don't get it, can you explain what your code is suppose to do?

      Comment

      • Torgg
        New Member
        • Dec 2007
        • 41

        #4
        Originally posted by halo combat22
        I don't get it, can you explain what your code is suppose to do?
        I'm setting up an object then I set the object to the Picture1 box then I set the font. I then put some text in the object and that text shows in the Picture1 box. This is how you do a "Print Preview" with a Picture box. You should be able to just copy and paste the code below right into your List1_Click event.

        Private Sub List1_Click()
        Dim objPrint As Object
        Set objPrint = Picture1
        objPrint.Font.N ame = "Arial"
        objPrint.FontSi ze = "10"

        objPrint.Print nnumber
        End Sub

        I hope you found this helpfull,
        Torgg

        Comment

        Working...