By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,553 Members | 1,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,553 IT Pros & Developers. It's quick & easy.

File input help

P: 24
I use VB6.
Expand|Select|Wrap|Line Numbers
  1. Dim nnumber As Integer: Dim sName As String
  2. Private Sub Command1_Click()
  3. Open "input1.txt" For Input As 1
  4.     Do Until EOF(1)
  5.         Input #1, sName, nnumber
  6.         List1.AddItem sName
  7.     Loop
  8. End Sub
  9. Private Sub List1_Click()
  10.     Picture1.Print nnumber
  11. 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
Expand|Select|Wrap|Line Numbers
  1. Bob
  2. 200
  3. Mike
  4. 232
  5. Dick
  6. 2322
Dec 17 '07 #1
Share this Question
Share on Google+
3 Replies

P: 41
Give this a try

Expand|Select|Wrap|Line Numbers
  2. Private Sub List1_Click()    
  3.     Dim objPrint As Object
  4.     Set objPrint = Picture1
  5.     objPrint.Font.Name = "Arial"
  6.     objPrint.FontSize = "10"
  8.     objPrint.Print "123456 TEST"
  9. End Sub
Dec 17 '07 #2

P: 24
I don't get it, can you explain what your code is suppose to do?
Dec 17 '07 #3

P: 41
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.Name = "Arial"
objPrint.FontSize = "10"

objPrint.Print nnumber
End Sub

I hope you found this helpfull,
Dec 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.