Results 1 to 9 of 9

Thread: List boxes from a database file

  1. #1

    Thread Starter
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827

    Post

    You have to hard-code in the team names? Aren't they in the database?

    Ok, You might want the value stored behind the text in the teams list box to be the team's ID number. I assume all the players on the same team have the same team ID. This will allow you easily search the players DB for all players with the same correct team ID. You could use SQL (not sure if it will work with your database - I think it has to be ODBC) or just code the search yourself, by searching for all the players in the team, and maybe putting them in their own recordset. Or keep track of their record numbers (or player IDs if they have them), or maybe the records' bookmarks (something I'm having trouble with - I might be wrong about bookmarks). It really depends on what you're familiar with.

    Once you've identified your team members, You should be able to stick 'em in your second list box without too much trouble.

    When you've finished editing that team, I'd update the records in your main player database, if you made a separate recordset for them.

    Hope this helps.

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Can you open the database file via code?

    What is the provider/format?

    Tell me tell me tell me!

    Thanks

  3. #3
    New Member
    Join Date
    Nov 1999
    Location
    Tiffin, OH, USA
    Posts
    5

    Post

    I am working on an editor for NBA Live 2000 and would like to add some list boxes that let the user choose a team from a list box which will then bring the list of players on that team into another listbox. The user can then click on the player they want to edit. The teams are stored in one file (Teams.dbf) and the players in another (Players.dbf), but have a link to the team by the team id (a number).

    I'm having trouble getting this set up. Can anyone point me to a place that might be helpful or give some clues on things to try?

    Thanks.

    Trey-Z
    [email protected]

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    I don't think EA uses a standard database format....I believe I've tried a while ago to look at a NHL 99 DBF file. Are you able to open the database file successfully?

  5. #5

    Thread Starter
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827

    Post

    What kind of trouble are you having? From what you've said it sounds like a relatively simple bit of code. You should be able to use list1.listitem(list1.list) (or something similar) if I remember, to get the selected contents. Or, depending how you filled the listbox, you may be able to ascertain the record number you need using just list1.list.

    From this you should be able to use a suitable event (list1_onclick or a separate button maybe) to update the contents of your second listbox, and proceed in a similar way to the first listbox.

    I'm not sure if this is helpful at all. Maybe you've tried this and it doesn't work for some reason. I hope I'm not telling you something you already knew.

    If you're some kind of veteran programmer, maybe you can help me with my post on VBScript!

  6. #6

    Thread Starter
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827

    Post

    Clunietp has a point

    Can you actually open the file? It seems strange that they should leave it in a standard format.

  7. #7
    New Member
    Join Date
    Nov 1999
    Location
    Tiffin, OH, USA
    Posts
    5

    Post

    Clunietp - Yes, I can open the files just fine. People have been using my editor for a couple of months now, but without this bit of functionality that I've been trying to figure out how to add.

    HarryW - My main problem is getting the listboxes filled. I think that once I get that accomplished, the rest should be relatively straightforward. I can get the teams filled, but only if I hard code in the team names.

    Trey-Z
    [email protected]

  8. #8
    New Member
    Join Date
    Nov 1999
    Location
    Tiffin, OH, USA
    Posts
    5

    Post

    Here's the code I used. I also discovered that I accidentally deleted the source code for my players editor. Oops.

    dbOpen.Filter = ".dbf files|*.dbf"

    dbOpen.ShowOpen

    If dbOpen.FileName = "" Then
    End
    End If

    CompleteName = dbOpen.FileName
    ThePath = Left(CompleteName, (Len(CompleteName) - 10))
    TheName = Right(CompleteName, 10)

    dbName = ThePath
    Connect = "dBase IV"

    Set TeamDB = OpenDatabase(dbName, False, False, Connect)
    Set dtaTeams.Recordset = TeamDB.OpenRecordset("Select * from Teams.dbf")

  9. #9
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    Ahhh....DBase 4, thanks TreyZ3!

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