Results 1 to 3 of 3

Thread: [2005] Checking Net Connection, Does vb have a database?,minor question about objects

  1. #1

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

    [2005] Checking Net Connection, Does vb have a database?,minor question about objects

    Ok I have a few questions i'd like to know, if anyone can help me that'd be great

    Question 1: How do I check to see if the user has an internet connection?
    And basically setup an event so

    For a game

    They click login, if they're not online, it pops up, with a MessageBox and says "You cannot login without an internet connection"

    If they login and are connected, and then during the game, if you disconnect from the internet, it will return you to the main menu,

    Can anyone tell me how thats done?

    Question 2: Does vb have a built in database? or something?
    I've seen a few threads that make it look like it does, if so does anyone know a tutorial (good or bad) for using its database?

    And would it be possible to upload that database information to a mysql database? or something?

    If it doesn't, what can I use as a database with vb (Microsoft Access?)

    Question 3:

    I declare my objects / structures like this
    Code:
    Structure db
            Public e As EventArgs 'if I dont have some normal variable, it gives an error saying it hasn't had a variable initilized or something, why is this?
            Shared pass(Integer.MaxValue) As String
            Shared user(Integer.MaxValue) As String
        End Structure
    Thanks in advance
    Last edited by Icyculyr Fr0st; May 30th, 2007 at 07:08 PM.

  2. #2
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] Checking Net Connection, Does vb have a database?,minor question about objects

    Question 1: You can check to see if a user is connected to the Internet by pinging a server or website. Make sure that the server or website you choose does not block ICMP messages. Use a timer to routinely check the Internet connection to verify that the user is still connected.

    Question 2: VB does not have its own database. You can use it to connect to and manipulate databases, though. If this is not a commercial product, then you can use an MS Access database, or download a copy of SQL Express (Its Free).

    Question 3: I haven't checked this code but John is online and is good at catching errors. So try this:

    Code:
    Public Structure db
         ' Use Dim to declare your variables
         Dim e As EventArgs
         Dim pass(Integer.MaxValue) As String
         Dim user(Integer.MaxValue) As String
    End Structure
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

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

    Re: [2005] Checking Net Connection, Does vb have a database?,minor question about obj

    This line:
    vb Code:
    1. Public e As EventArgs
    declares a variable. A reference-type variable, i.e. a variable whose type is a class, is NOT an object. That line does not create any object so the variable refers to Nothing. You would have to create an object and assign it to the variable somewhere in your code.

    As I said in your other thread, I can't see that structure definition having any place in a well-designed app. It is very suspect.
    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