I would like to add a button to a form that clears the contents of a text box, a bit like using cls to clear the clutter from a powershell window.
Does anyone know how to code this?
The form was created using primalforms, in the form search results are piped to the text box which is read only to the user. I would like to give users the ability to clear previous results before performing the next search
Can you add a cls function to clear a text box
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Can you add a cls function to clear a text box
I recommend reading the blog here. It has an excellent tutorial on how to design GUIs and plenty of info on how controls work.
http://www.sapien.com/blog/topics/user- ... istrators/
http://www.sapien.com/blog/topics/user- ... istrators/
Re: Can you add a cls function to clear a text box
I had already looked at that, it's very useful but doesn't give any pointers to the specific function I want to add here.
What I want is not a mission critical requirement but a nice to have option so users can clear what is displayed before performing another search so it is easier for them to read their results. It may become a requirement later as there is the possibility it will be used by people with access to sensitive information who will need the ability to quickly hide what is on their screen
What I want is not a mission critical requirement but a nice to have option so users can clear what is displayed before performing another search so it is easier for them to read their results. It may become a requirement later as there is the possibility it will be used by people with access to sensitive information who will need the ability to quickly hide what is on their screen
Re: Can you add a cls function to clear a text box
What I am trying to do is to get you to look at how we design GUI forms. You are asking questions and thinking like you are using a command prompt. Forms are not like that.
When you do a new query and assign the results to the control it will replace the results in the control. It does not add to the control unless you are specifically requesting that it be added.
You should spend time reading and trying the examples in the blog and the related articles under "Spotlight on Controls".
There is no equivalent of cls in Forms. You can write a function to clear all controls as needed. Remember that "clear" is a concept that applies to a form. CLS is a command that applies to a console screen.
You can code a loop over the Forms.Controls collection and clear ach control in the loop but you have to only clear controls that actually have content. Buttons do not have content.
When you do a new query and assign the results to the control it will replace the results in the control. It does not add to the control unless you are specifically requesting that it be added.
You should spend time reading and trying the examples in the blog and the related articles under "Spotlight on Controls".
There is no equivalent of cls in Forms. You can write a function to clear all controls as needed. Remember that "clear" is a concept that applies to a form. CLS is a command that applies to a console screen.
You can code a loop over the Forms.Controls collection and clear ach control in the loop but you have to only clear controls that actually have content. Buttons do not have content.