Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In visual basic/VB.net, in the visual studio IDE, I am having trouble with a tex

ID: 3919404 • Letter: I

Question

In visual basic/VB.net, in the visual studio IDE, I am having trouble with a text box. In the textbox, when the program runs, I have a negative symbol already there. That is intentional. However, I want that negative symbol to be locked in place so the user can't edit it. The user should be able to insert numbers after that negative symbol in the same textbox, but the negative symbol has to remain there. It can't be removable.

The reason is, my program sends commands to signal generators and power amplifiers. The power in dBm has to be negative. I do not want someone to accidentally make it positive.

Explanation / Answer

Solution

Try like this.

I have just given the logic and it is not complied solution. It may get some compiler error but, you could do like this by assigning SuppressKey property to true when cursor location is withing a locking area and when the user presses Backspace or Delete key it will not allow user to delete ur remove by backspace. You should also check ASCII value for [Ctrl+X]. So user cannot cut the text from there.

Feel free to reach out regarding any queries . And please do rate the answer . Thank you .

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote