textbox

Add event listener to Excel Textbox (lose focus)

瘦欲@ 提交于 2019-12-23 19:26:01
问题 I need to fire an sub or a command when a user is done using a text box in Excel. I have tried using the AfterUpdate() event and the LoseFocus() event like this: Public Sub Kommentar_AfterUpdate() MsgBox ("Hurray") End Sub The text box is named Kommentar and is inside the sheet Radio . Also, where is the code supposed to be written? i have tried placing it in code sheet for the Radio sheet, and in a separate module. Any tip, hint or answer is appreciated! 回答1: For embedded ActiveX Excel

Do not allow Enter Key to make a new line in MultiLine TextBox C#

假装没事ソ 提交于 2019-12-23 19:25:41
问题 I set the property Multiline=true; . I do not want to allow the Enter Key to make a new line. How can I solve this issue? 回答1: That could be as simple as listening to TextChanged event and then executing the following line inside it: txtYourTextBox.Text = txtYourTextBox.Text.Replace(Environment.NewLine, ""); This solution involves some screen flicker though. A better way is to prevent it entirely by listening to KeyDown event: private void txtYourTextBox_KeyDown(object sender, KeyEventArgs e)

WPF: cannot access ComboBox's TextBox with FindName

做~自己de王妃 提交于 2019-12-23 19:14:54
问题 I saw that I can access the templated parts of a ComboBox (the TextBox , PopUp and Button ) via the FindName method. The TextBox should be accessible by using cb.FindName("PART_EditableTextBox") , however, this always returns null for me. As per melya's suggestion, I have tried using cb.Template.FindName("PART_EditableTextBox", cb); instead -- this works on a simple test app, but not my own. The difference, perhaps, is that I'm trying to do this before the ComboBox is loaded or initialised (I

How to hide caret in Delphi TEdit?

一世执手 提交于 2019-12-23 16:08:29
问题 I want to remove the caret from a TEdit control in Delphi. I have made the component Enabled := False but the caret still appears. My question is how to remove the caret from a disabled TEdit control? 回答1: I assume that you mean TEdit control. The solution is HideCaret function, the only problem is where to call it. The 2 event handlers below worked fine for me: procedure TForm18.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin HideCaret(Edit1.Handle); end; procedure

How to create a read only TextBox style

一曲冷凌霜 提交于 2019-12-23 16:07:22
问题 I am trying to create a TextBox which is readonly and which has no animation or mouse focus using the following xaml style. However I want to be able to change the background colour but this style will not allow changes to the background colour. I think I am not understanding the basic concepts here because it seems it is not possible to simply set the Background property itself, in the same way the foreground property can be set - why is that and how do I create a TextBox style that is read

Textbox validation for IP Address in WPF

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 12:56:14
问题 I'm making a WPF Application using C#. I want to put validations on integers (0123456789 and ".") only.. The textbox is supposed to contain an IP address... So need to ensure that user key in their correct "IP Address" before they click on the "Submit" button... How can I achieve it? Thanks. 回答1: You can easily implement this using Wpf binding validation rules or by using a custom masked textbox Check these links for exactly what you are looking for http://geekswithblogs.net/QuandaryPhase

set cursor position in textBox javascript

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 10:53:37
问题 I am trying to add new line to textBox and update textBox value with new line character in JavaScript using following code: ele.value = ele.value + "\n"; ele.focus(); // To update cursor position to recently added character in textBox ele.setSelectionRange(value.length, value.length); Above code updates textBox value but doesn't update cursor position to new line. (Though it updates cursor position when I click outside of textBox and again click inside textBox, but not when textBox is already

how do i set value of a textbox using javascript

岁酱吖の 提交于 2019-12-23 10:29:10
问题 I am trying to get a value fro query string and assign that value into a textbox. I am able to get the value from query string but unable to assign it to textbox. document.getElementByName('Contact0Email').Value = email; Tried the above code but doesn't seem to be working. Though the alert of email gives the right value. 回答1: You need a lower-case value and a plural Elements : document.getElementsByName('Contact0Email')[0].value = email; You need the [0] to get the first element in the list.

Get text from asp:textbox

↘锁芯ラ 提交于 2019-12-23 09:36:50
问题 I am writing ASP.NET project in C#. The UpdateUserInfo.aspx page consists textboxes and button. In pageLoad() method I set some text to the textbox and when button is cicked I get the new value of textbox and write it into DB. The problem is even if I have changed the value of textbox textbox.Text() method returns the old value of textbox ("sometext") and write this into DB. Here the methods: protected void Page_Load(object sender, EventArgs e) { textbox.text = "sometext"; } void Btn_Click

How to deselect textbox if user clicks elsewhere on the form?

烈酒焚心 提交于 2019-12-23 09:35:06
问题 Currently in my application it is impossible to deselect a textbox. The only way is to select another textbox. My users and I agree that clicking anywhere else on the form should deselect the current textbox. I tried overriding the MouseDown on many controls and having the focus set to a random label but it doesn't work for some controls like the MenuStrip or scrollbars. Any ideas? 回答1: Assuming you have no other controls on your forum, try adding a Panel control that can receive focus. Set