Easy label question...

  • Thread starter Thread starter Bruce D
  • Start date Start date
B

Bruce D

On my form I want to make a label visible when the user clicks a button
(long process running in background). I have the visible property set to
false at design time. On the click event of the button I set the property
to true...
The only way I got the label to actually appear while the long process runs
was to use 'me.refresh()' after I set visible=true and before I run the
process....
My question is: Should I use me.refresh? Will me.refresh try to refresh my
datagrid? The process seems to be running forever now...not sure if it's
related.

-bruce
 
Bruce,

Assuming that it is a winform, than it should be showed up direct.
There should be anoter error, show at least that button click event when you
want some more help


Cor
 
Cor,
I should have mentioned it is a WinForm. It doesn't show up without the
"me.refresh()". Here's my code...seems straight forward.


Private Sub btnAddress_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAddress.Click
SearchAddress()
End Sub
Private Sub SearchAddress()
Dim strLimit As String = ""
Dim strSQL As String
If Me.txtPhone.Text.Length > 0 Then
Me.lblMessage.Visible = True
Me.Refresh()
Select Case Me.tabSearch.SelectedIndex
Case 0
Me.dgFinder.DataSource = Nothing
strSQL = "WHERE Finders.phone = '" & Me.txtPhone.Text &
"'"
GetFinderData(strSQL, strLimit)
dvFinders.Sort = "zip"
Me.dgFinder.SetDataBinding(dvFinders, "")
Case 1
MessageBox.Show("You cannot use 'Phone' with your
current view." & Chr(13) & Chr(10) & "Please select another view or search
field.", "Invalid Search Criteria")
Me.txtPhone.Focus()
Case Else
' nothing
End Select
Me.lblMessage.Visible = False
Else
MessageBox.Show("Please provide a valid 'Phone'.", "Invalid
Search Criteria")
Me.txtPhone.Focus()
End If
End Sub

-bruce
 
I even tried...and it doesn't work either...

Private Sub btnAddress_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAddress.Click
Me.lblMessage.Visible = True
SearchAddress()
Me.lblMessage.Visible = False
End Sub

Private Sub SearchAddress()
' blah
End Sub

-bruce
 
I've had the same problem in an application I wrote. There was a
lengthy process of copying files over a network. Right before that
function was called, I set a panel's visiblity to true which contained a
label "Please wait, blah blah blah" and a progressbar. When I set the
panel's visibility to true, the progressbar became visible, but the
label text wasn't. I had to throw a Me.Refresh() between making the
panel visible and calling the file copying function.

I also got some good use out of it for my splash screen when changing
the text of what it was currently loading. Without calling Refresh, the
label's text just wouldn't change.

At least it's a simple fix. But you definately aren't alone in this.

Jeff
 
Bruce,

I see it upi only setting to false in this snippet.
(You set it once to true, however set that again to false at the end)
End Select
Me.lblMessage.Visible = False
Else

Why do you do that?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Tab Control on a Form Conditionally Visible? 2
Bug in IDE? 9
filling a datagrid 1
Problem with form refreshing 2
refresh App 2
Radio Buttons loosing checked state 2
Long Process 30
how to refresh the form 3

Back
Top