I want to make my textbox display the text "Username" or "Password" but when the user starts typing it in it starts editing that text. I want that text to then disappear.
the image of what Im trying to make
Are you using Visual Basic or C# for this? Regardless, Visual Studio should have a "PlaceholderText" option under the "Properties" menu on the right-hand side when you click on your text box.
Related
My question might be simple but I couldn't find specific answer on web.
I have a winforms application with a grid inside, in which I have implemented a context menu to be shown on right click on cells. These cells include text elements that can be edited. When user clicks or double clicks on the cell, the text can be edited and that's what I want. The problem is when the text is in edit mode and user right clicks on it again, 2 context menus are shown on each other. One is my context menu and the other is windows right click on text including options like copy, paste etc.
I wonder if there is any event like "text being edited" or "windows default context menu opened" that can be used for such scenarios? Or what is the proper way of solving this problem, which I guess must be a common one.
In these cases I want to show only the windows right-click menu, not mine.
Perhaps you need the Control.GotFocus event: https://msdn.microsoft.com/en-us/library/system.windows.forms.control.gotfocus%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
You could look for focus, then prevent right clicks in the control until the control has lost focus (Control.LostFocus). If the control gets focus from a right click, then you could open your context menu (I think).
I am new to Windows Form application and trying to build a small application.
I had dragged and dropped a label on the main form.
Then I deleted its text property to empty string basically hiding the label.
Now I would like to move this label to some other location on the form but unable to do so because I cannot find it.
I checked the designer file and its there.
But I cannot find it in the form so that I can grab it and move to a different location.
Please help.
Thanks
Use Document Outline. Look at the following images.
That happens to me several times, and a few weeks ago I found a way to get the empty label like this:
On the tab "Properties" just click on the arrow to show all controls and click on the label you want, this will automatically select the label on your form..
In my test studio automation test case for a web page, I have a test step which is simply input some text into a text box. The problem is the text disappear right after inputting.
Same situation would occur when I use Selenium Webdriver in C#.
Have you ever met this before? Please give me some help.
In selenium use IJavaScriptExecutor class to set Text box value .If it doesn't work try clicking an element out of the text box after entering text box value.
In Test Studio try focusing on the text box element (you can do that by clicking on the element) and use the following code for typing the text:
Manager.Desktop.KeyBoard.TypeText("your text here", 50);
I have reachtextbox and want to search text like notepad in silverlight in separate dialog.. Find text and search that text in huge text entered in richtextbox.
How can I do it using separate dialog like notepad and search text and edit and highlight it in richtextbox?
I'd use a Mediator to send messages between search form and text form. You can declare an event like "OnSearch" in your search form and suscribe to it from your text form. When the event raises, you should send an eventarg with the string you want to search.
The text form should suscribe to the "searchMessage" with a string parameter. The Business layer for text form should implement a "search" method that looks for every string/substring depending on your search options. Then change text color for each coincidence.
Searching strings:
http://msdn.microsoft.com/en-us/library/ms228630(v=vs.80).aspx
You can also use the Find method in RichTextBox.
To change the color of that text you have to set the text as selected and then change the color of that selection:
SelectionStart, SelectionLenght, SelectionColor.
I've got a basic extension that - highlights text (currently an xml open tag ) and provides a context menu button which will open a WPF form. What I'd love is an easy way to pass the content of ... to the form when the button is clicked (and back from the form later). What would be fine as well is doing the same with selected text (select the text, hit the button on the context menu...). The thing is, I can't find a reasonably easy way to pass text (selected or processed) to the form from the editor window to the form.
Is there an easy way to do this?