Ok fairly new to this but the programming i am doing is for a "price list" of sorts, i have 3 buttons with 3 labels which work fine showing the label text when pressed, next i have a group box with one button, 2 radio buttons, and 2 labels, I have successfully gotten it to "hide" the opposite label and show the text in the corresponding label for the radio button when the main button in the box is pressed, problem is if i select one then the other both are hidden. also, trying to create a "reset" button for the bottom to clear all the text from the labels but seem to be getting it wrong, tried putting in the labels as .visible=false but that just hides the labels all together, tried to "hide" text but that gave me an error. I know this has to be simple but the book we have for the class is set up with exercises in each chapter and this one isn't in the book so finding out how to program each element of this to work together is impossible to find, even using the index and looking up each element. I know i'm just missing one or two little things, any advice?

You need to play with CAPTION property of the control for the purpose.

It can be simply reset by taking all the controls in a loop.

To clear all the text on labels, use the following -

In a module -

Public Sub ClearLabels(frm As Form)

Dim Control As Control

 For Each Control In frm.Controls
        If TypeOf Control Is Label Then
            Control.Caption = vbNullString
        End If
    Next Control
End Sub

In your form under the "reset" button -

Call ClearLabels (Me)

To set the visible properties, use an if then statement -

If optButton1.Value = 1 Then
Label1.Visible = True
Label1.Visible = False
End If
This article has been dead for over six months. Start a new discussion instead.