Results 1 to 2 of 2

Thread: Assign variables to a string: Weight("Bob") = 200 ???

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    2

    Assign variables to a string: Weight("Bob") = 200 ???

    OK, so I'm still getting the hang of VB and haven't learned the ins and outs yet, so there's probably a very simple answer on here if i just knew the language to search for the correct thing, so i apologize if this question is either excessively simple or redundant.

    My problem:

    I'm programming a college football game, and I want to keep statistics for all of the different teams during a season. The teams are identified by strings...

    Now, it would be a lot easier for me to follow the code and keep it condensed if I could assign values to these teams by name. In other words, if my team is Florida State, I would like to have the following values:

    passyards("Florida State")
    rushyards("Florida State")
    qbrating("Florida State")

    But I can't figure out how to assign these variables (passyards, rushyards, qbrating) to a string ("Florida State"). It would be easy enough if this was a regular array with a numberical value in parenthesis like passyards(1), passyards(2), etc., but I'd rather be able to work directly with team names to make the code easier for me to follow.

    I know you used to be able to do this back in the day with quickbasic, but I can't figure out how to do it now. Any help is greatly appreciated!

  2. #2
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: Assign variables to a string: Weight("Bob") = 200 ???

    search on how to use "user defined types"
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width