Raffigee
04-07-2003, 09:49 AM
hey guys here's a question:
I hope i can explain myself clearly.
ok say you want to create an array of players assuming they are always the same when you start the program example:
type player
name as string
age as integer
etc
end type
public player(1 to 10) as player
sub read stats
player(1).name = John
player(1).age = 25
etc...
ok that's fine but if you want to add a second player using a userform
is this possible without having to use a workshheet ????
Raffi
TheProphet
04-07-2003, 09:52 AM
Why Cant you just do Player(2).Name e.t.c to add a second player
Removed extreme language - Mill
Raffigee
04-07-2003, 10:35 AM
Why Cant you just do Player(2).Name e.t.c to add a second player
A worksheet is a spreadsheet in excel. I can't do player(2).name because i don't know the player's name yet. The player opens the program and enter's his name in a userform. if his name is not in the list the list grows and then you have a player #2 and the list grows every time a new player is added.
i can do this by writing the new player's name in a spreadsheet cell but i'm asking if there's a way to do it so i don't need excel. so that i can take my cody copy it directly into Visual basic and make an .exe out of it. Now Visual Basic does not understand the term worksheet and terms like range("A1").
thanks in advance
Raffi
You would need to store the data externally somehow - either in a text file (like a data file), an INI file, or the registry.
Raffigee
04-07-2003, 11:43 AM
Thanks again Mill. do you know where can i find info on the procedure on how to store things in a txt or ini file ?
Thanks again Mill. do you know where can i find info on the procedure on how to store things in a txt or ini file ?
Goto the General Board. For using a text file as your data file, you can do a search for Input, Open, and either Write or Print.
Using an INI file is a little more tricky, but also a bit more elegent. Doing it correctly involves the use of API calls, however.
Robse
04-08-2003, 06:26 AM
so that i can take my cody copy it directly into Visual basic and make an .exe out of it. Now Visual Basic does not understand the term worksheet and terms like range("A1").
Just a side note: Visual Basic does understand those terms once
you've made a reference (Project -> References) to the Excel Object Library (and have instantiated an Excel Object).
I'm not suggesting you do this, just to show you it's possible.