![]() |
Ping: Visual Basic Programmers
I am trying to learn VB programming and my first project is a very simple soccer game based on attack and defence ratings. What I want to do is store the teams and their rating in a .dat file that can retrieve the ratings as each team plays. It is very simple. The only data I need to store is the team name (example, Liverpool) the nickname, (The Reds), home ground (Anfield), attack rating (an integer between 1 and 100) and defence rating (between 1 and 100).
What is the best way to do this? Just create a text document with something like Liverpool,The Reds,Anfield,78,76? Or do I have to create some kind of input form and write the data to a file that way? Thanks guys. |
create a type for the team.. like this:
Code:
Type tTeamThe use random access to retrieve the data lets see if I remember this.. might be a bit sloppy, but whatever Code:
Oh.. and obviously you need to save as well.. check this article out: http://support.microsoft.com/kb/150700 Since you have so few variables, you might actually use textfiles rather than binary files though.. That's much easier.. Use the same type, but start by creating a textfile like this: Liverpool,Anfield,60,70 Arsenal, Emirate Stadium, 99,99 Then use this little sub to read rather than the stuff I used above (replace everything from Open to Loop Code:
Dim arTeam() as StringThis might need a few changes.. a bit tired here.. and I'm basically writing from memory.. |
Thanks alot man. I'll give that a try.
Quote:
You must be an Arsenal supporter :) |
Quote:
Chelsea,Toilet,1,1 :) |
Quote:
|
Quote:
I would have gone with Shithole but yeah I agree. :D |
Now I assume I can do something similar with the fixture list. I would like to assign each team a number from 1 to 20 and then have the fixtures look like this:
1,20 2,19 3,18 with the home side listed first. Then at the end of the season renumber all the teams so that the fixtures change. Does that sound right? |
Quote:
In that case after today it would be Portsmouth 99,99 right? :D |
| All times are GMT -5. The time now is 11:25 PM. |
Powered by vBulletin Version 3.6.0
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.