mattisrowe
mattisrowe

Reputation: 149

Changing the Visible property for a label on a windows form, after the form has been displayed

So i have a windows form built in VB.NET that get's displayed which is used as a filter window... there is an "ok" button which starts the process of building the sql query and requesting the data.

lblLoading.Visible is defaulted to False in the Designer...the code on the ok button click is as follows:

Private Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Click

    ' Some validation here

    lblLoading.Visible = True

    ' Code to get Data

    lblLoading.Visible = False

End Sub

when this code executes the label is not shown... i tried changing the value to true in the designer, and it displays when the form is opened but doesn't hide itself when that code runs.

I'm more used to using C# WPF for forms and in there i would do something like raise an on property changed event to propagate that back to the view so i'm wondering if there is something similar i have missed here?

Thanks in advance

Upvotes: 1

Views: 716

Answers (1)

Matthew
Matthew

Reputation: 462

Quick solution? Add this on the line after your Visible = True:

Refresh()

or

Me.Refresh()

Don't use it often (like inside a loop!). Let me know if that helps!

Upvotes: 2

Related Questions