[Gambas-user] How top clearing a readonly textbox
T Lee Davidson
t.lee.davidson at gmail.com
Sat Nov 26 17:19:50 CET 2022
On 11/26/22 11:02, gian via User wrote:
> If that's what you're referring to:
> https://lists.gambas-basic.org/pipermail/user/2022-November/077470.html
> I keep understanding it differently from yours.
Yes, that is the one to which I was referring. In that, he says:
> I'm trying to clear a form by going through all the controls and trying to "clear" them.
[snip]
> I know it could be done with a lot of complex checking for what type of
> control each one is but I was trying to avoid that.
>
> Dim thisTextBox as TextBox
> Dim thisTextArea as TextArea
> ' etc etc etc etc
> ...
> For Each ctl as Object in Me.Controls
> If ctl Is TextBox Then
> thisTextBox=ctl
> if not thisTextBox.ReadOnly then thisTextBox.Clear
> Else If ctl Is TextArea
> etc
> Else If ctl Is MyCustomTextBox
> etc
> Else If ctl Is etc etc etc etc for up to 3 gazillion control types and custom control types
From the first sentence, I gather he is wanting to clear any control that has a Clear method. And, he mentions not only
TextBox, but also TextArea, MyCustomTextBox, and "up to 3 gazillion control types and custom control types".
I hope that helps.
--
Lee
More information about the User
mailing list