C# How can I get masked password from textbox? - c#

I've set property of my textbox1 with PasswordChar = '*' and textbox display correct text that is ****.
But when I want to use that masked text (****) by set label1.text = textbox1.text, why label1.text show plain password text which not masked and how can I get masked text from my textbox1?

To use a TextBox for passwords, just set the PasswordChar value to anything other than NULL and it will automatically hide the characters typed.
This is purely for display purposes and so if you copy the text elsewhere it won't be hidden.

Then you should customize the label to display text as masked and you should extended PasswordChar property to label.

Related

How to create a read only text box

I need to create a text box that the user can't change the value of.
Also I would like the text box to display the value of another combo box and update when that combo box's selected item changes
Please help me.
Click on the Text Box and in the Properties Tab change the value of ReadOnly to “True”
TextBox.ReadOnly = true; should do the trick

Multiline Textbox that receives the lines on top

I have a multiline textbox that receives values from a different class, and I want that every line is added on top instead of the bottom, how can I do that?
Use String.Insert():
textBox.Text = textBox.Text.Insert(0, string.Format("{0}\r\n", "Your text content here"));

Over come placeholder text with innerText

What I want to do is to fill it with text programatically.
webBrowser1.Document.GetElementById("textBox").InnerText = "foo";
This code works but some websites have a placeholder text. This code will not allow me to fill this as value but instead it as a placeholder text.
Strangely in some text box, it will be paste as value when there are a placeholder text. But some text box it wont.
Another scenario is that when it is innerText is placed as a placeholder text, all I have to do is click on that text box and write something next to it. This will act as a text box values.
Is there another way around this?
You need to set the value attribute of the <input id='textBox'> elment not the innertext.
webBrowser1.Document.GetElementById("textBox").SetAttribute("value", "text text text");

How to add text boxes dynamically when one text box is filled?

I have text box to fill the ph.numbers in that, here what i want is, whenever i'm entering the value in that text box i need to add another empty text box dynamically where i can add another value in that in the same way if they are entering any value into this new empty box another empty text box should add at the bottom of this. And after all there is a confirm link button. When clicking on it all these ph.numbers entering on the text boxes should get. How is it possible?
You add textboxes dynamically using jquery and on the button click/submit there values to the server. What you can do is on keyup event of a textbox you can add another below it.
Try this.
I'm basing this condition that your number format is of 11, Ex: 09123456789
So on the Textbox_Textchanged event of your textbox.
if(textbox.text.length >= 11)
{
Textbox text = new Textbox();
text.TextChanged += Textbox_Textchanged; // So it would also trigger the event
// Do positioning here
}
Im thinking you can better optimize this by having a better EventArgs but you get the idea right?

How to set borders of a custom textbox for PAssword type?

I have 2 text boxes with USername & PAssword. I got a class RoundedCornerTextbox from http://www.codeproject.com/KB/edit/RoundedCornerTextbox.aspx. It works well with username textbox. But with PAssword textbox it shows actual password instead of "*" - the password char of Textbox.
How can I handle this situation in the RoundedCornerTextbox class ? If I just set the text to "**" (* as many as size of text) in DrawString(), then when I retrieve pswdTxt.Text, the data received will be "*" only and not actual text.
Ok, if you want rounded corner text box, you can use free Krypton toolkit textbox component. It supports textbox border rounding. What you need is to set property:
int howMuchRoundCorners = 5;
kryptonTextBox.StateCommon.Border.Rounding = howMuchRoundCorners;

Categories

Resources