By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,267 Members | 1,808 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,267 IT Pros & Developers. It's quick & easy.

Delay in making control visible when connecting to database

P: n/a
Joe
I'm connecting to an Oracle database and running a query which returns
data. The query can be fairly long - 2-3 minutes. I have a label set
up on the form which is invisible to begin with. I want to make it
visible (with it's message) when the user clicks a button to run the
query. The label informs the user that the system is getting the data.

My code to do this is:

Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRun.Click

labWork.Visible = True

This works perfectly if no other code comes after. However, if my code
to connect to the database and run the query comes after it, then the
label does not show up until the connection to the database completes
and the data is returned.

Is there a way to force this label to be visible BEFORE the connection
to the database is made? Any ideas?

I would eventually like to use a progress bar in this case, but it was
having the same problem. I simplified it to just use a label assuming
that would be easier.

Thanks in advance.

Aug 7 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Joe,

You might try labWork.Refresh() immediately after making the label visible.

Kerry Moorman
"Joe" wrote:
I'm connecting to an Oracle database and running a query which returns
data. The query can be fairly long - 2-3 minutes. I have a label set
up on the form which is invisible to begin with. I want to make it
visible (with it's message) when the user clicks a button to run the
query. The label informs the user that the system is getting the data.

My code to do this is:

Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRun.Click

labWork.Visible = True

This works perfectly if no other code comes after. However, if my code
to connect to the database and run the query comes after it, then the
label does not show up until the connection to the database completes
and the data is returned.

Is there a way to force this label to be visible BEFORE the connection
to the database is made? Any ideas?

I would eventually like to use a progress bar in this case, but it was
having the same problem. I simplified it to just use a label assuming
that would be easier.

Thanks in advance.

Aug 7 '06 #2

P: n/a
Joe
Kerry,

That did it. Thanks!

-Joe

Aug 7 '06 #3

P: n/a
Hello joe,

The reason your label doesn't show is because database operations (for the
most part) are blocking operations. This means that the thread they execute
in stop pumping messages while the database work is being performed. Since
you are doing this work on the UI thread, your UI becomes unresponsive.
You can instead do the work on a separate thread.. or you may wish to massage
the message pump manually from time to time.

-Boo
I'm connecting to an Oracle database and running a query which returns
data. The query can be fairly long - 2-3 minutes. I have a label set
up on the form which is invisible to begin with. I want to make it
visible (with it's message) when the user clicks a button to run the
query. The label informs the user that the system is getting the
data.

My code to do this is:

Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnRun.Click

labWork.Visible = True

This works perfectly if no other code comes after. However, if my
code to connect to the database and run the query comes after it, then
the label does not show up until the connection to the database
completes and the data is returned.

Is there a way to force this label to be visible BEFORE the connection
to the database is made? Any ideas?

I would eventually like to use a progress bar in this case, but it was
having the same problem. I simplified it to just use a label assuming
that would be easier.

Thanks in advance.

Aug 7 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.