Usercontrol question

  • Thread starter Thread starter EricW
  • Start date Start date
E

EricW

Hi,

I have created my very first usercontrol.
It has a textbox and a button next to it.

It working is as follows:

Text is displayed in the textbox and if property Hidden is true, then it
will display * (real ones) in the box.
The normal text value is stored in a tag property.
When the user clicks the button, it checks first if the user is allowed and
if so, it changes the * for the normal text.
Click it again and the text is replaced by * again.

What I am trying to do now, is to make the button invisible when the
property Hidden is set to True.

Me.txtCell.Text = myTag2
If myHidden = True Then
btHide.Visible= False
Me.txtCell.Text = New String("*"c, Me.txtCell.Text.Length)
Else
btHide.Visible = True
End If

Strangely enough not just the button disappears, also the textbox does.

Is this normal behaviour? How can I go arround that?
Or am I doing something wrong?

rg,
Eric
 
EricW said:
Hi,

I have created my very first usercontrol.
It has a textbox and a button next to it.

It working is as follows:

Text is displayed in the textbox and if property Hidden is true, then it
will display * (real ones) in the box.
The normal text value is stored in a tag property.
When the user clicks the button, it checks first if the user is allowed and
if so, it changes the * for the normal text.
Click it again and the text is replaced by * again.

What I am trying to do now, is to make the button invisible when the
property Hidden is set to True.

Me.txtCell.Text = myTag2
If myHidden = True Then
btHide.Visible= False
Me.txtCell.Text = New String("*"c, Me.txtCell.Text.Length)
Else
btHide.Visible = True
End If

Strangely enough not just the button disappears, also the textbox does.

Is this normal behaviour? How can I go arround that?
Or am I doing something wrong?

rg,
Eric

Hi Eric,

TextBox has a PasswordChar property you can use to hide the Text. Setting
the PasswordChar property will display the specified character instead of
regular ones. The text will still be available in the Text property.

If you set the button to invisible only the button will disappear, if
anything else also disappears, you most likely have some programming
glitches, like setting the UserControl.Visible to false instead of just the
button.
 
Back
Top