Hello, I wanna asking
How to Make a Waiting while Proccessing? I mean
I want when the software proccessing login into my Online database, the Button1,TextBox1,TextBox2, LinkLabel1,LinkLabel2 will hide and the Waiting Picture is show,

Here is my code :

Button1.Visible = False
Button2.Visible = False
TextBox1.Visible = False
TextBox2.Visible = False
LinkLabel1.Visible = False
LinkLabel2.Visible = False
PictureBox1.Visible = True 
MySQLConnection = New MySqlConnection
        MySQLConnection.ConnectionString = "server=blablabla;Port=3306; User ID=blabla; password=blabla; database=blabla"
        Dim MyAdapter As New MySqlDataAdapter
        Dim SqlQuary = "SELECT * From blabla WHERE blabla='" & TextBox1.Text & "' AND password = '" & TextBox2.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("Login Failed! Invalid Username Or Password")
            uInterface.username = TextBox1.Text
        End If

But when i click the button 1, the Button1,TextBox1,TextBox2, LinkLabel1,LinkLabel2 there hide and PictureBox1 Show when MsgBox show "LoginFailed! Invalid Username Or Password"

I wanna make the Button1,TextBox1,TextBox2, LinkLabel1,LinkLabel2 hide and picturebox1 show after that Process the Login Verification Into database.

Sorry For my Bad Details, Please Help Thanks

Recommended Answers

All 2 Replies

If you really want to do that, then i would suggest to use a backgroundworker.
Before starting this worker, you disable all controls that you need to disable and display the wait image.
In the dowork event of that worker you do your sql query.
In the work_complete event of this worker you then enable all your fields again and hide the image.


Imports System.ComponentModel

Public Class LoginBGW

	Private Sub ToogleControls(enabled As Boolean)
		txtLogin.Enabled = enabled
		Button1.Enabled = enabled
		PictureBox1.Visible = Not enabled 'remember to set the visible property on the designer to false, else it will show up at the first time.
	End Sub

	Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
		Dim BGW As New BackgroundWorker
		With BGW
			.WorkerSupportsCancellation = False
			AddHandler .DoWork, AddressOf BGW_DoWork
			AddHandler .RunWorkerCompleted, AddressOf BGW_Completed
		End With
	End Sub

	Private Sub BGW_DoWork(sender As Object, e As DoWorkEventArgs)
		'do your login stuff here
		'once it is completed the "BGW_Completed" get raised

		'for testing
	End Sub

	Private Sub BGW_Completed(sender As Object, e As RunWorkerCompletedEventArgs)
	End Sub

End Class

Thank you

Problem Solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.