• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

OOP in VB, sort of

mjquilly

Golden Member
I really don't know VB very well, and need some help. This is for a school project, we are designing a board game, and I need a way to store the player information during the game. For example, the players name, age, token, money... I think I could do this in a database no problem, but the way we are doing this (it's a group project), I'm not allowed. I'm trying to relate this to C++. I don't need to make a Player Class, since all I'm looking for is to store information, not manipulate it directly. I would like to use something like a C++ "struct", does VB have this? I think that would be the best and I have no idea. ie:

dim PlayerInfo as Struct
dim PlayerName as string
dim PlayerAge as int
dim PlayerToken as int 'represents which token of token array
dim PlayerMoney as float
...


[edit]To be more specific, the game will have up to 3 players. I want to set up the PlayerInfo Struct, class, whatever, then create an array of PlayerInfo of size 1-3, depending on how many players there are. Then I would get the info for player 1 and put it into PlayerInfo[1].PlayerName, PlayerInfo[1].PlayerAge.......


anything like this in VB?

thanks for helping anyone!
 
The VB "equivalent" of Struct is Type. Try the online help to see more.

I recommend using a class, though. It's so easy in VB!
 
Back
Top