Tom's Subject Directory & City Building Fan Site

Search a Section of this site or the Entire Site
site search by freefind

Welcome! Your IP address is;

Installed on this system:
  • Microsoft Visual Studio 2008
    Version 9.0.30729.1 SP
    Installed Edition: Standard
  • Microsoft .NET Framework 3.5
  • MySQL Connector/Net 6.2.4

Links you may need to visit:

Microsoft Express Site
Microsoft Update Site
Example databases for MySQL
MySql Connector/NET Tutorials

justhost UK banner

justhost banner


Visual Basic 2008 & Mysql Version 5

An Article and Tutorial:  Connecting to MySql

Login Form UI & Properties

The login form I made as a simple login - Username, Password and server status. It consists of three labels two text boxes and two buttons, one of which isn't necessary at all, the Refresh button. Its function is to clear the textboxes, place focus on txtUsername and connect again. I placed it to provide a little more balance to the form and it allowed me to test further without restarting debug **.

The first label is for displaying the status of the server connection. Its properties are set as (default if not listed);

  1. Name = svrStatus
  2. AutoSize = True
  3. TabIndex =  4
  4. Text = Server Status

Second label;

  1. TabIndex =  5
  2. Text = Username

Third Label;

  1. TabIndex =  6
  2. Text =  Password

First (upper) TextBox, for User Name input;

  1. Name = TxtUsername*
  2. TabIndex =  0

Second TextBox, for Password input;

  1. Name = txtPassword
  2. TabIndex =  1

Login Button;

  1. Name = btnLogin
  2. TabIndex =  2
  3. Text = Login

Refresh Button;

  1. Name = btnRefresh
  2. TabIndex =  3
  3. Text = Refresh

The Login button submits the Username and Password as part of the SELECT query to the MySql database. The Refresh button clears the textboxes, gives focus to the Username TextBox and calls Connect() to show a status change. This button and code can be eliminated completely without affecting the purpose of this article.

*    Used to build query string and taken from DB table shown in Part III

**    Allows testing different usernames and passwords without restarting debug.

Login Form

Warning: mysql_connect(): Access denied for user 'tmnobles_tom'@'' (using password: YES) in /home4/tmnobles/public_html/Subject_Directory/Visual_Basic/comments/config.php on line 15
Could not connect to MySQL