I am using the simple Dialog box given in the following link as a crude (that's all I need) password input box:
http://www.csharp-examples.net/inputbox-class/
How do I set the text to display **** instead of the password?
In that control you have a TextBox, set the PasswordChar property of the textbox to *.
Also see: How to: Create a Password Text Box with the Windows Forms TextBox Control
In your control's show method, after defining that textbox, add:
textBox.PasswordChar = '*';
use like this
textBox1.PasswordChar = '*';
From How to: Create a Password Text Box with the Windows Forms TextBox Control
To create a password text box
Set the PasswordChar property of the TextBox control to a specific character. The PasswordChar property specifies the character displayed
in the text box. For example, if you want asterisks displayed in the
password box, specify * for the PasswordChar property in the
Properties window. Then, regardless of what character a user types in
the text box, an asterisk is displayed.
// The password character is an asterisk.
textBox1.PasswordChar = '*';
From TextBox.PasswordChar property
Gets or sets the character used to mask characters of a password in a
single-line TextBox control.
textBox1.PasswordChar = '*';
Just set that property on your text box and it should work.
From the property window in windows forms
Related
I'm new to visual studio and I'm developing an application for visually impaired. I'm testing my application with NVDA. The audio feedback I'm getting on moving focus to a TextBox using tab button is just "Edit-Blank". I want to change that to a custom text. How can I do that?
That has nothing to do with accessibility, actually. When developing for accessibility, please always keep in mind the following: a blind (deaf, ...) user must get the same info as all of your users, starting from yourself, unless you absolutely need to convey something that is inaccessible otherwise (a visual tooltip instead of a sound for deaf users, an alternative text description of an image for blind users, etc.).
Here NVDA tells you what you actually get: the edit box is blank, indeed. If you want to describe the box, you need a label, not something in the text box (let the user enter his/her text in it). So:
private Label myLabel;
// ...
this.myLabel = new Label();
// ...
this.myLabel.Text = "Your Name:";
and place that label to the left (or above) the edit box. You may also set AccessibleRole, if you want:
this.myLabel.AccessibleRole = AccessibleRole.StaticText;
I suggest to do this if your form is actually a dialog box.
You need to put a Label control into the form and update the TabIndex properties of the Label and TextBox, so that the Label's TabIndex value is one less than the TextBox's TabIndex value (e.g. label1.TabIndex == 1 and textBox1.TabIndex == 2).
Then, the Text of the Label will be read when entering the TextBox.
To make a TextBox more accessible by NVDA you can perform either of the following settings:
You can set AccessibleName
You can set AccessibleDescription
You can put a Label control near the TextBox having immediate TabIndex before the TextBox.
For Narrator you can perform either of the following settings:
You can set AccessibleName
You can set Cue Banner for the TextBox.
You can put a Label control near the TextBox having immediate TabIndex before the TextBox.
Is it possible to change the forecolor of substring in element text in GridControls's Tileview in devexpress winforms?
What's going to happen is I have a textbox and tileview
In event while textbox textchanged fire, the text matched in tileview's element text will be highlighted
The initial color of tileview's text will be blue and if its match with textbox's text it will be highlighted as gray.
See picture to check the illustration:
Is it possible? or will i need another component to attain this output?
As far I can see there is property group called Appearance (TileView.Appearance) and there you have property called ForeColor. Moreover, you can acces via code by calling
titleViewName.Appearance.ForeColor = <RGB value goes here>
Finally, there is possibility for dynamic customization via event ItemCustomize.
For further information please check official documentation and DevExpress forum. There already existis questions similiar to yours.
You can try to use HTML Text formating for displayed string:
Text = "This is some <color=red>red or <color=black><b>bold</b> text!"
In C# I have a multiline text box that users enter case notes into. However when they enter the text box and hit enter, it leaves the text box and jumps to the next field like the tab button. Any way to over ride this behavior and make the return key move down a line? I don't need to disable the return key behavior on the entire form, only in the one multiline text box.
Thanks.
You need to set the property
textBox.AcceptsReturn = true;
Without this property you could use CTRL+ENTER to initiate a newline.
Sometimes this is useful if you need to have a default AcceptButton also set on the form.
See MSDN documentation
Set the AcceptsReturn property to true.
I'm using WPF (C#).
I want the user to be able to only type one line in a rich text box (can't press enter key).
Could anyone tell me how can I set up this kind of rich text box property?
Set its AcceptsReturn property/attribute to false.
I am developping in C#.
I need to capture a password written inside a Text Box, but would like to not show the password that is being typed, showing instead **** or any other character to hide the password.
How can I do that? I'm sure it's by modifying an attribute, but can't find which one.
http://msdn.microsoft.com/en-us/library/d3223ht2.aspx
set the PasswordChar property of the textbox
Set the PasswordChar property.
There is a property on the TextBox class called "UseSystemPasswordChar" (assuming winforms) that let you do this.
To use your own custom character:
http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.passwordchar.aspx
To use the system default character:
http://msdn.microsoft.com/en-us/library/system.windows.forms.textbox.usesystempasswordchar.aspx
textBox1.UseSystemPasswordChar = true;
//or
textBox1.PasswordChar = '%';