5 Replies - 531 Views - Last Post: 19 November 2012 - 01:56 PM Rate Topic: -----

#1 sasou  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 19-October 12

what's wrong

Posted 18 November 2012 - 01:57 PM

hi i have a visual basic assignment and i'm stuck wit something
when i press on display button the picture box will display the grades that saved in file named (grades.txt).
and that,s my code but it keep telling me there is wrong with code
 Private Sub Command1_Click()
Open "d:\grades.txt" For Input As #1

End Sub

and thanks in advance

and i can make the file from the notepad right?
i wrote the number like this
10,15,20,30

This post has been edited by JackOfAllTrades: 18 November 2012 - 03:56 PM
Reason for edit:: Fixed code tags


Is This A Good Question/Topic? 0
  • +

Replies To: what's wrong

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,755
  • Joined: 26-March 09

Re: what's wrong

Posted 18 November 2012 - 02:09 PM

What does it tell you is wrong, i.e.: What error do you get?

If you stuck reading the text file, then check out the Snippets and Tutorial sections.
Was This Post Helpful? 0
  • +
  • -

#3 sasou  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 19-October 12

Re: what's wrong

Posted 18 November 2012 - 02:14 PM

it tells me that the file is already open but there is no showing num
Was This Post Helpful? 0
  • +
  • -

#4 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,755
  • Joined: 26-March 09

Re: what's wrong

Posted 19 November 2012 - 01:20 AM

Look at using the FreeFile method for getting a free file handle.

Also look at closing the file handle after you've used it (so it won't be open!).

And as I said in my previous post, look at the snippets and tutorials here which will tell you how to read text files.....Just because you open the file, the contents won't automatically be read in to your program.

You should look at what I've said and give it a go yourself and post back with any issues you have.
Was This Post Helpful? 0
  • +
  • -

#5 sasou  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 19-October 12

Re: what's wrong

Posted 19 November 2012 - 01:09 PM

yeah i did it thanks alot i feel like im a genius hhhh
Was This Post Helpful? 0
  • +
  • -

#6 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,755
  • Joined: 26-March 09

Re: what's wrong

Posted 19 November 2012 - 01:56 PM

For the benefit of others, perhaps you could post your solution.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1