[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?
Re: [2005] Error, 'Throwing Exception'
What are the details of the exception?
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.
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)
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.