textbox

C# textbox disable shortcuts

醉酒当歌 提交于 2019-12-23 02:49:28
问题 i use a textbox inside my windows form application and i need to disable the shortcuts CTRL + I and CTRL + H . I tried many different solutions i found via google but it won't work. I use CTRL + I already as a custom shortcut in my app and i do not want to have a tabstop inserted by this command inside my textbox. For whatever reason CTRL + H acts like pressing delete? If i set "Shortcuts enabled" to false in the properties of the control CTRL + I and CTRL + H are still working. CTRL + C or

Limit the number of characters of a textbox [duplicate]

心不动则不痛 提交于 2019-12-23 02:36:28
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Specifying maxlength for multiline textbox How to set maxlength for multiline TextBox? I want to limit the number of characters of a text box. For this i used <asp:textbox id="txtAdmissionDate" runat="server" MaxLength="5"> </asp:textbox> It's working fine. But when i add TextMode="MultiLine" attribute to it, the maxlenth is not working. Please Help 回答1: If you want to let the user know if he exceeded the amount

Textbox - Validate input before paste

雨燕双飞 提交于 2019-12-23 02:28:05
问题 On my Textbox only accepts Alphanumeric characters and a underscore using the Keypressed event but I am having problems when I right click on the textbox and pasted special characters and accepts it Is there a way to validate the string from there before clicking paste? Any answers will help thanks! 回答1: You may 1- Disable shortcuts for the textbox that would disable Ctrl-C, Ctrl-V, and the second line(will assign a empty context menu, with no items and will override the original context menu

Removing transparency from color

偶尔善良 提交于 2019-12-23 01:14:26
问题 Currently I am using this code to convert my RGB string to a color to set as a the background for a Text Box. ColorConverter colorConverter = new ColorConverter(); colorTextBox1.BackColor = (Color)colorConverter.ConvertFromString(displayColor); But I get this error when I run this code. when the value of displayColor = "#16776960" . An unhandled exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll Additional information: Control does not support transparent

How to display remaining textbox characters in a label in C#?

风流意气都作罢 提交于 2019-12-22 17:52:46
问题 I'm not sure if I have the last bit right? I changed the max length of the textbox to 140. I can't seem to use TextLength . Help please?! I have this so far: protected void textBox_TextChanged(object sender, EventArgs e) { characterCountLabel.Text = textBox.MaxLength - textBox.TextLength; } 回答1: characterCountLabel.Text is in string format. So you might want to convert it before you set its value like this: protected void textBox_TextChanged(object sender, EventArgs e) { characterCountLabel

Get value of dynamically created textbox

风流意气都作罢 提交于 2019-12-22 16:37:01
问题 I'm in a bit of a pickle at the moment, I've created a bit of code that creates 4 textboxes and adds them to a table layout at run time (code below) but I'm struggling with getting text from it, I tried getting the value from it as you would string s = TxtBox1.Text.ToString(); but it just gets a null reference, then I tried txt.Text.ToString(); and this just gets the text from the last text box that was created. private void button2_Click(object sender, EventArgs e) { int counter; for

WPF TextBox obtain and set caret position from mouse pointer

筅森魡賤 提交于 2019-12-22 11:34:07
问题 I am trying to set TextBox caret position according to the mouse coordinates when hovering over the TextBox. I can obtain the mouse coordinates relative to the TextBox by using Mouse.GetPosition(this.MyTextBox) but I need help translating those coordinates into the caret position. Any help would be greatly appreciated! 回答1: MyTextBox.CaptureMouse(); MyTextBox.CaretIndex = MyTextBox.GetCharacterIndexFromPoint(Mouse.GetPosition(MyTextBox), true); 回答2: MyTextBox.GetCharacterIndexFromPoint(..)

How to prevent users from typing special characters in textbox [duplicate]

 ̄綄美尐妖づ 提交于 2019-12-22 11:01:09
问题 This question already has answers here : How do I make a textbox that only accepts numbers? (35 answers) Verifying that a string contains only letters in C# (10 answers) Closed 4 years ago . I need to validate a password entry on a textbox, I have a few demands to fullfill in order to allow the user profile to be created and one of them is to refuse registration if the password contains anything else different than numbers and the alphabet letters the system needs to deny the entry,

How to insert text into TextBox in Word Macro

岁酱吖の 提交于 2019-12-22 10:28:13
问题 I created a text bo in the Word and I would like to insert text into it: Sub k() Dim Box As Shape Set Box = ActiveDocument.Shapes.AddTextbox( _ Orientation:=msoTextOrientationHorizontal, _ Left:=50, Top:=50, Width:=100, Height:=100) //HOW TO INSERT HERE TEXT INTO TEXT BOX End Sub 回答1: Here is the solution: Sub k() Dim Box As Shape Set Box = ActiveDocument.Shapes.AddTextbox( _ Orientation:=msoTextOrientationHorizontal, _ Left:=50, Top:=50, Width:=100, Height:=100) 'The solution for you: Box

How to force a textbox to split, rather than move to a second page in SSRS 2005 (PDF Export)?

久未见 提交于 2019-12-22 10:26:56
问题 This question is a follow up to my original question, I've done a bit more reseach, i narrowed a problem down quite a bit. I've also uploaded a sample .rdl to illustrate the problem I've got the following report setup: a header (image in the body), two textboxes, and a footer. First textbox has a little bit of text, and second textbox has lots of text. Second textbox can fit on one page by itself, but won't fit on the page with my header and the first textbox. The problem is that for some