mariobkk

Ok, I got a login form which connects fine to my database. I used the following code:

Imports MySql.Data.MySqlClient

Public Class frmLogin

Dim conn As MySqlConnection

Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click

Application.Exit()

End Sub

Private Sub Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click

conn = New MySqlConnection()

conn.ConnectionString = "server=" & txtServer.Text & ";" _

& "user id=" & txtUsername.Text & ";" _

& "password=" & txtPassword.Text & ";" _

& "database=test"

Try

conn.Open()

MessageBox.Show("Connection Opened Successfully")

conn.Close()

Catch myerror As MySqlException

MessageBox.Show("Error Connecting to Database: " & myerror.Message)

Finally

conn.Dispose()

End Try

End Sub

End Class

Now, I try to figure out which code I need to use that the project itself is loading after I logged in already. Anyone can help me out



Re: Visual Basic Express Edition Login successful, now what?

js06

Since noone has answered,

i may not be fully following you but, are you looking for something like this

Try

conn.Open()

MessageBox.Show("Connection Opened Successfully")

conn.Close()

Catch myerror As MySqlException

MessageBox.Show("Error Connecting to Database: " & myerror.Message)

Finally

conn.Dispose()

Process.Start("your app location \ your app name .exe")

End Try

End Sub

End Class






Re: Visual Basic Express Edition Login successful, now what?

mariobkk

The "process" command was exactly what I was looking for, but now I got another Problem :-)

Everything work and the application is loading after successful login, but it brings me the login screen again

How do I need to code it that the application is loading, but not again the login screen because otherwise I will always only see the login screen. The code I use now, below teh code above is

Process.Start("D:\My Documents\Visual Studio 2005\Projects\Test Suite\Test Suite\bin\Debug\Test Suite.exe")





Re: Visual Basic Express Edition Login successful, now what?

DMan1

Pseudo Code:

Code Snippet

Try

conn.Open()

MessageBox.Show("Connection Opened Successfully")

if Logon() then

StartApplication()

else

TryLogonAgain()

end if

Catch myerror As MySqlException

MessageBox.Show("Error Connecting to Database: " & myerror.Message)

Finally

conn.Dispose()

Process.Start("your app location \ your app name .exe")

End Try

End Sub

End Class

Private Function Logon() as Boolean

If PwAuthenticated() then

Return True

else

Return False

End If

End Function






Re: Visual Basic Express Edition Login successful, now what?

js06

It sounds like what you are looking for is to open (start) the next form.

Try

conn.Open()

MessageBox.Show("Connection Opened Successfully")

conn.Close()

Catch myerror As MySqlException

MessageBox.Show("Error Connecting to Database: " & myerror.Message)

Finally

conn.Dispose()

form1.show here you start the next form

End Try

End Sub

End Class






Re: Visual Basic Express Edition Login successful, now what?

mariobkk

Thanks a lot guy's, the code from js did the trick.





Re: Visual Basic Express Edition Login successful, now what?

mariobkk

Sorry Guy's one more thing.

The login form stays open even after the MDI form has been loaded. How do I get the Login to close

Me.close () doesn't work





Re: Visual Basic Express Edition Login successful, now what?

js06

me.close works if it's in the loginform

maybe it's how you have it coded (where the code is)

or something to do with the shutdown mode in the project properties - set it to when last form closes

sometimes i have had weird issues with minor things like this even when everything is set right

instead you could try the load event for the mdi form

loginform.close()

if none of this helps post your code again for us