Create a Password Text Box Tutorial

1 Answer 368 Views
TextBox
fabrizio
Top achievements
Rank 1
Veteran
fabrizio asked on 05 Jul 2021, 12:08 PM

Good morning
I wanted to follow the tutorial to make a RadButtonTextBox password control with a button to the right of the textbox to show the password.
I found a tutorial but can't find how to add the image. The tutorial page is this

https://docs.telerik.com/devtools/winforms/knowledge-base/create-password-textbox

, can someone please tell me how to add the image?
Thanks so much
Fabrizio

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Jul 2021, 01:17 PM

Hello, Fabrizio,

The two images eye32 and eye32hidden are added as a Resource in the project. Then, the button element that shows the eye is added to the right buttons panel that RadButtonTextBox  offers. More information how to add buttons to the left/right side of the control is demonstrated in the following help article:

https://docs.telerik.com/devtools/winforms/controls/editors/buttontextbox/populating-with-items/adding-items-programmatically 

I have prepared a sample project for your reference. Please give it a try and see how it works for your scenario.

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Damien
Top achievements
Rank 1
commented on 01 Jul 2023, 05:37 AM

How can I use this method for a TextBoxControl instead of just the TextBox?

The part it doesn't seem to like is this

radButtonTextBox1.RightButtonItems.AddRange(radButtonElement1);

Dess | Tech Support Engineer, Principal
Telerik team
commented on 04 Jul 2023, 01:32 PM

Hi, Damien,

RadButtonTextBox is a different control compared to RadTextBox and RadTextBoxControl. It offers separate collections for storing the left/right button elements:

https://docs.telerik.com/devtools/winforms/controls/editors/buttontextbox/structure 

Could you please share your concerns and why the specific RadButtonTextBox is not appropriate for your scenario and you want to change it with another control? Thus, we would get better understanding of the precise case and think about an appropriate solution. Thank you in advance.

Damien
Top achievements
Rank 1
commented on 05 Jul 2023, 02:13 AM

Hi Dess

The issue I have with a "TextBox" component is the selection highlight colour cannot be changed to fit the theme of the application.

If I can use the RadButtonTextBox and change the selection highlight colour, I think I can use it.

Thanks.

Damien
Top achievements
Rank 1
commented on 05 Jul 2023, 02:46 AM | edited

Actually, I just tried it, and the button does not work when used on a touchscreen device but works when you attach a mouse. Therefore it is of no use to me unless the touch can also work.

I had to change it to a RadToggleButtonElement for the touch device to work and set it as toggled on or toggled off.

Dess | Tech Support Engineer, Principal
Telerik team
commented on 07 Jul 2023, 08:40 AM

RadButtonTextBox internally uses RadTextBox. Hence, it also hosts the standard MS TextBox which doesn't allow changing the selection color: 

https://stackoverflow.com/questions/34666064/change-the-textbox-highlight-color-when-a-user-selects-text 

Using a RadToggleButtonElement is also a suitable approach. Feel free to use it if it achieves the custom requirement you need to cover.

If you need any further assistance please don't hesitate to contact me. 

 

Damien
Top achievements
Rank 1
commented on 08 Jul 2023, 12:10 AM

Can you disable the right-click context menu?

thanks

Dess | Tech Support Engineer, Principal
Telerik team
commented on 11 Jul 2023, 01:38 PM

Hi, Damien,

Yes, you can disable the right-click context menu for RadButtonTextBox by using the following line of code:

this.radButtonTextBox1.TextBoxElement.TextBoxItem.TextBoxControl.ContextMenu = new ContextMenu();

Before:

After: no context menu on right-click:

 

NTSAdmin
Top achievements
Rank 1
commented on 09 Oct 2024, 12:58 PM

Damien

 

Did you ever get a solution here? I was looking at Adding Buttons to RadTextBox—WinForms TextBox Control—Telerik UI for WinForms, where I can add the button with an icon. However, doing so increases the size of the text box's height. It's not a huge deal, but I would love to keep the textbox height the height it was originally designed to be.

 

 

 

Nadya | Tech Support Engineer
Telerik team
commented on 14 Oct 2024, 06:57 AM

Hello, NTSAdmin,

In this forum thread a RadButtonTextBox control is discussed. However, you said that are looking into Adding Buttons to RadTextBox—WinForms TextBox which refers to RadTextBox which is another control.

Can you please clarify which is the exact control that you use since RadTextBoxButton and RadTextBox are two different controls in our suite. They may have similar behavior but their inner element's structure is different:

What I can suggest is to consider using smaller images, by setting some size of the image so that it can fit into the textbox or set some margin or padding of your text box. If you are still having difficulties, it would be much helpful if you provide a sample project or a code snippet with the exact problem that you are facing. Thus, I could be able to provide further assistance. 

I hope this information is useful. Please let me know if I can assist you further.

Tags
TextBox
Asked by
fabrizio
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or