textbox

Weird TextBox issues with .NET 4.5 - no '.' allowed

耗尽温柔 提交于 2019-12-22 04:33:21
问题 I've got a really weird problem related to .NET 4.5. Today a User told me that he isn't able to enter floating numbers into a Textbox (like "2.75"). The textbox just doesn't accept ".", which is the correct 'seperator' for floating numbers in my Culture ("de-CH"). This issue occurred after I compiled the software with .NET 4.5 (formerly it was 4.0). I can reproduce this error. All other textboxes in the application are working fine. The textbox is a regular WPF Control. No fancy user defined

wpf: Selecting the Text in TextBox with IsReadOnly = true?

a 夏天 提交于 2019-12-22 03:23:14
问题 I have this TextBox. This TextBox is located in DataTemplate : <DataTemplate x:Key="myTemplate"> <TextBox Text="{Binding Path=FullValue, Mode=TwoWay}" IsEnabled="False" /> ... and I want to allow User to select the whole text inside it (optionally by clicking on the Textbox). And I don't want to use any code behind. How to do that? Thanks in advance. 回答1: Using the IsReadOnly property instead of IsEnabled allows the user to select text. Also, if it shouldn't be edited, a OneWay binding should

How to get the NEW text in TextChanged?

瘦欲@ 提交于 2019-12-22 02:20:31
问题 In a TextBox I'm monitoring the text changes. I need to check the text before doing some stuff. But I can only check the old text in the moment. How can I get the new Text ? private void textChanged(object sender, EventArgs e) { // need to check the new text } I know .NET Framework 4.5 has the new TextChangedEventArgs class but I have to use .NET Framework 2.0. 回答1: Getting the NEW value You can just use the Text property of the TextBox . If this event is used for multiple text boxes then you

C#: how to insert string containing new lines into TextBox?

ぃ、小莉子 提交于 2019-12-22 02:01:35
问题 How do you insert a string containing new lines into a TextBox? When I do this using \n as the new line character, it doesn't work. 回答1: You have to set the multiline property of the textbox to true and you can use Environment.NewLine as the new line char. You can also use \r\n instead of Environment.NewLine TextBox1.Text = "First line\r\nSecond line" 回答2: As the other answers say you have to set .Multiline = true , but I don't think you then have to use the Lines property. If you already

check if object is a textbox - javascript

大兔子大兔子 提交于 2019-12-22 01:32:58
问题 I understand that we can use (javascript) if (typeof textbox === "object") { } but are there methods which will allow me to ensure that the object is a textbox? 回答1: var isInputText = obj instanceof HTMLInputElement && obj.type == 'text'; 回答2: As of 2016 , use this: function isTextBox(element) { var tagName = element.tagName.toLowerCase(); if (tagName === 'textarea') return true; if (tagName !== 'input') return false; var type = element.getAttribute('type').toLowerCase(), // if any of these

casting new System.Windows.Forms.Control object to System.Windows.Forms.Textbox

和自甴很熟 提交于 2019-12-22 01:26:11
问题 i get an InvalidArgumentException while casting Control to System.Windows.Forms.Textbox: Unable to cast object of type 'System.Windows.Forms.Control' to type 'System.Windows.Forms.TextBox'. System.Windows.Forms.Control control = new System.Windows.Forms.Control(); control.Width = currentField.Width; //here comes the error ((System.Windows.Forms.TextBox)control).Text = currentField.Name; I am doing this, because I have different Controls (Textbox, MaskedTextbox, Datetimepicker...), which will

new line in TextBox (JavaFX 2.0)

你离开我真会死。 提交于 2019-12-21 21:23:19
问题 I'm trying to create TextBox with JavaFX 2.0 . My source is following: TextBox textBox = new TextBox(); textBox.setPrefSize(150, 600); textBox.setText("Hello\n world!"); Result is: How could I create new line in TextBox ? 回答1: Creating a multilined TextBox is a JavaFX 1.3 feature. In JavaFX 2.0 you have to use a TextArea. TextArea textArea = new TextArea(); textArea.setPrefRowCount(2); textArea.setText("Hello\nworld!"); The JavaFX UI Controls tutorial does not mention the TextArea control.

AutoComplete TextBox Multiple Entries Comma Separated

拈花ヽ惹草 提交于 2019-12-21 20:57:23
问题 Is there any way of making a TextBox widget that autocompletes, but allows you to autocomplete each time you have a separator, for example a ",". Let's say I want to write a list of fruits in a textbox, for example: "Apples, Pears" ...and my list of valid entries is let's say [ Apples, Pears, Oranges, Clementines ] so each time I type a comma it resets the autocompletion, so that for example "A" was autocompleted to "Apples", but then typing a comma and then typing "Pe" will auto-complete to

Clearing many textbox controls in vb.net at once

不想你离开。 提交于 2019-12-21 17:52:18
问题 I am using the following code to clear the txtint1.Clear() txtext1.Clear() txttot1.Clear() txtint2.Clear() txtext2.Clear() txttot2.Clear() txtint3.Clear() txtext3.Clear() txttot3.Clear() txtint4.Clear() txtext4.Clear() txttot4.Clear() txtint5.Clear() txtext5.Clear() txttot5.Clear() txtint6.Clear() txtext6.Clear() txttot7.Clear() txtint8.Clear() txtext8.Clear() txttot8.Clear() Is there any possibility to clear all the textbox controls at once or with few lines of code? 回答1: You could put them

In Which TextBox is the cursor.?

自作多情 提交于 2019-12-21 17:30:05
问题 I have 4 textboxes and a submit button in my webpage Suppose the user enters data in 2 fields and then clicks the submit button. I now want to know in which textbox the cursor was located just before the submit button was clicked. Any Idea on how to do this in javascript..?? 回答1: Your question does specifically say in javascript , but FWIW here is another option in jQuery: Working jsFiddle here HTML: <input id="in1" type="text" /><br /> <input id="in2" type="text" /><br /> <input id="in3"