Results 1 to 5 of 5

Thread: [2005] Error, 'Throwing Exception'

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Location
    Australia
    Posts
    237

    [2005] Error, 'Throwing Exception'

    Not sure why, but it says that, this is my code,

    Code:
    Structure db
            Public e As EventArgs
            Shared pass(Integer.MaxValue) As String
            Shared user(Integer.MaxValue) As String
        End Structure
    
    'Begin load
        Private Sub Game_Menu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Setup database usernames and passwords
            db.user(0) = "" 'first error, if I comment this out
            db.pass(0) = "" 'this will show as an error
    
        End Sub
    Not quite sure why, can anyone tell me?

  2. #2
    Hyperactive Member Troy Lundin's Avatar
    Join Date
    May 2006
    Posts
    489

    Re: [2005] Error, 'Throwing Exception'

    What are the details of the exception?
    Prefix has no suffix, but suffix has a prefix.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Error, 'Throwing Exception'

    I'm guessing that you are just doing that because you don't know how many elements there will be, but to create an array with over 2 billion elements just in case is not the answer. Surely you couldn't possibly need even nearly 2 billion elements and surely you must know that. If you don't know how many elements there will be then either provide functionality to resize the array as and when needed or else use a collection instead.

    I really can't see that structure definition having any place in a sound design either. I'd be interested to know exactly how you intend to use it because it looks rather dodgy to me.
    Last edited by jmcilhinney; May 30th, 2007 at 08:37 PM.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Location
    Australia
    Posts
    237

    Re: [2005] Error, 'Throwing Exception'

    I dont know how to use any database stuff yet, So im just making a string i'll loop through to check if the username / password is correct

    Also, maybe 2billion aint such a great idea, lol,

    Basically I need to setup a real database lol (I want an online textbased game)

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Error, 'Throwing Exception'

    What you should do is forget your game for the moment. Create a new project that is designed specifically to give an opportunity to get used to ADO.NET. Once you've learned how to create and access a database then you should go back to your game and implement that knowledge. That's what you should do for all new concepts. Always practice first on projects that isolate the concept you want to work on, then combine it with other concepts when you're comfortable. If you try to work on too many new things at once you often end up botching the lot.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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