Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / August 2006

Tip: Looking for answers? Try searching our database.

Delay in making control visible when connecting to database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joe - 07 Aug 2006 18:09 GMT
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.
Kerry Moorman - 07 Aug 2006 20:02 GMT
Joe,

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

Kerry Moorman

> 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
[quoted text clipped - 22 lines]
>
> Thanks in advance.
Joe - 07 Aug 2006 21:16 GMT
Kerry,

That did it.  Thanks!

-Joe
GhostInAK - 07 Aug 2006 21:52 GMT
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
[quoted text clipped - 23 lines]
>
> Thanks in advance.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.