Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Splash screen not displaying properly

Status
Not open for further replies.

Fozzie22

Programmer
Dec 3, 2003
59
AU
Hi all,

I am modifying the VB.NET How-To Sockets Client program for a little project.

The first thing this program does is create a new tcp client to connect to the server program. If the server is down it displays a message "Server is down"

Before the connection is made I have opened a new form which I want to display these messages. However for some wierd reason the form doesent completly load until after connection is made or failed. I have posted the code below.

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim frmConnectUser As New frmConnectUser()

Dim frmSplash As New frmSplash()
frmSplash.Show()
frmSplash.label1.text = "Connecting"

Try
client = New TcpClient("localhost", PORT_NUM)

client.GetStream.BeginRead(readBuffer, 0, READ_BUFFER_SIZE, AddressOf DoRead, Nothing)

me.show
AttemptLogin()
Catch Ex As Exception
Me.Dispose()
End Try

End Sub

I dont see the "Connecting" label until after the program has either established a connection or failed.

Can somebody help me.

Thanks
 
I'd put a frmsplash.refresh and a frmsplash.label1.refresh b4 the Try.

Maybe this world is another planet’s Hell.
Aldous Huxley
 
or try Application.DoEvents after setting the label text

Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Hey guys,

I tried both your solutions but no joy. Its wierd, the form opens but where the label is supposed to show its just a white box. After the try the label shows.

Have you got any other ideas.

Foz
 
He he must be the end of the day. I put your code in the wrong place. It works awesome now.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top