Anyone know whats rong with this?
Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient
Public Class Login
Dim MySqlConnection As MySqlConnection
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
MySqlConnection = New MySqlConnection
MySqlConnection.ConnectionString = "server=!;Port=!; user id=!; password=intel; database=!"
MySqlConnection.Open()
Dim Myadapter As New MySqlDataAdapter
Dim sqlquary = "Select * From Users WHERE Username='" & UsernameTextBox.Text & "'AND Password='" & PasswordTextBox.Text & "';"
Dim command As New MySqlCommand
command.Connection = MySqlConnection
command.CommandText = sqlquary
Myadapter.SelectCommand = command
Dim Mydata As MySqlDataReader
Mydata = command.ExecuteReader
If Mydata.HasRows = 0 Then
MsgBox("Error! Wrong Login Information")
Else
MySqlConnection.Close()
Form1.Show()
Me.Close()
End If
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
End Class
Im trying to make it after you login, you close the login form and open the other form but its not working :/, it just closes both forms
Wierd Problem
Started by SirTech, May 31 2010 06:55 AM
5 replies to this topic
#1
Posted 31 May 2010 - 06:55 AM
|
|
|
#2
Posted 02 June 2010 - 06:05 AM
Form1.Show()
Me.Close()
just re-order these:
Me.Close()
Form1.Show()
if this is the main form in vb.net you can't close it :) or at least not in this way,
if the error prusuies,
just make the following
Me.hide()
Form1.Show()
Me.Close()
just re-order these:
Me.Close()
Form1.Show()
if this is the main form in vb.net you can't close it :) or at least not in this way,
if the error prusuies,
just make the following
Me.hide()
Form1.Show()
Share your Knowledge, It's one way to achieve immortality.
Video Tutorial Channel
Video Tutorial Channel
#3
Posted 02 June 2010 - 06:15 AM
Ray Tawil said:
if this is the main form in vb.net you can't close it :) or at least not in this way,
This is actually wrong. Just set 'Shutdown mode' to 'When last form closes' in the My Project/Application page. :)
#4
Posted 02 June 2010 - 06:19 AM
Vswe said:
This is actually wrong. Just set 'Shutdown mode' to 'When last form closes' in the My Project/Application page. :)
or at least not in this way <------
:)
Share your Knowledge, It's one way to achieve immortality.
Video Tutorial Channel
Video Tutorial Channel
#5
Posted 02 June 2010 - 06:20 AM
I saw that, but "this way" is the way you said (i.e the code) and that's still the way you use to make it work. :)
#6
Posted 02 June 2010 - 06:22 AM
Vswe said:
I saw that, but "this way" is the way you said (i.e the code) and that's still the way you use to make it work. :)
My point was not to confuse the guy with a problem other then the one he is already in. :)
Share your Knowledge, It's one way to achieve immortality.
Video Tutorial Channel
Video Tutorial Channel


Sign In
Create Account

Back to top









