Visual Basic game help
Discuss popular GCS tools like ZZT, Megazeux and Adventure Game Studio, as well as programming and other topics related to game design.
Visual Basic game help
Hi. I'm trying to make a game, and i need to know how to load a file to a rich text box and keep the line breaks.
This is how it is now:
1) Jeff 2) Jeff 3) DRM
This is how I want it to be:
1) Jeff
2) Jeff
3) DRM
Thanks in advance.
This is how it is now:
1) Jeff 2) Jeff 3) DRM
This is how I want it to be:
1) Jeff
2) Jeff
3) DRM
Thanks in advance.
<A href = "http://dosstuff.cjb.net" >Free Dos Stuff</a>
Jeff
Code: Select all
Private Sub [event name]()
Dim strNames As String
Dim strNames2 As String
Open "[filename.rtf]" For Input As #1
While Not (EOF(1))
Input #1, string1
Input #1, string2
input #1, string3
Wend
Close #1
End Sub
In your case, here's basically what it should look like...
Code: Select all
Private Sub [event name]()
Dim strNames As String
Dim strNames2 As String
Open "[filename.rtf]" For Input As #1
While Not (EOF(1))
'While not EOF means WHILE NOT at the END OF THE FILE...
Input #1, string1
'In your case, string1 should be 1)Jeff
Input #1, string2
'In your case, string2 should be 2)Jeff
input #1, string3
'In your case, string3 should be 3)DRM
Wend
Close #1
End Sub
I think if you want the user to be able to click the choice and have it execute, your best choice would be to use a Listbox. Let me know if you need more help with this.
-Richard-
wardrich
-
- Way too much free time
- Posts: 558
- Joined: Wed Apr 23, 2003 10:28 pm
- Location: Nowhere.
Splodginator
Jeff
to open multiple files, simply go
Just remeber to close each file that you open.
-Richard-
Code: Select all
Open "[filename.rtf]" For Input As #1
Open "[filename.rtf]" For Input As #2
Open "[filename.rtf]" For Input As #3
While Not (EOF(1))
Input #1, string1
Input #1, string2
input #1, string3
Wend
Close #1
Close #2
Close #3
End Sub
Just remeber to close each file that you open.
-Richard-
wardrich
Jeff
wardrich
- AngryDwarf
- Member
- Posts: 11
- Joined: Wed Sep 22, 2004 2:10 am
- Location: Australia
Post by AngryDwarf »
Im pretty sure thats only languages such as C,C++,C#,etcSplodginator wrote:Add "\n" or (I think) "\n\l" or "\n\r", I forget which one is Windows.
<marquee>veni vidi rapui</marquee>
AngryDwarf
Jeff
Post by barok_unlogged »
it's bad practise to open files as #1 or #2 or #3. instead, dimension a variable for each open statement. right before open, you have this:
openvariable = FREEFILE
freefile will get the next open number, so if you have #1 being used by another open statment and you try to open another file as #1, the program will crash. by having openvariable = freefile, it should prevent crashing.
openvariable = FREEFILE
freefile will get the next open number, so if you have #1 being used by another open statment and you try to open another file as #1, the program will crash. by having openvariable = freefile, it should prevent crashing.
barok_unlogged
Jump to
- Announcements
- ↳ Announcements
- General Discussion
- ↳ General Gaming
- ↳ Find Old Games
- ↳ Get Games to Work
- ↳ Game Help, Hints and Tips
- ↳ Game Creation
- ↳ Hardware
- Off-Topic
- ↳ General Off-Topic
- ↳ Media, Entertainment, & Music
- Site Forums
- ↳ Game Reviews
- ↳ dosgames.com Site Suggestions
- ↳ dosgamesarchive.com Site Suggestions
- ↳ playdosgames.com Site Suggestions
- ↳ Discussion Forum Trouble Reports
- ↳ Forum Suggestions
- Archive
- ↳ Webmasters Forum