textbox

ATM style decimal places

ぐ巨炮叔叔 提交于 2019-12-22 10:04:37
问题 I'm working on getting an old piece of code working, from 2003. I'm trying to replicate an ATM style decimal textbox. This code claims to have worked for someone, but I am having trouble implementing it. Maybe someone has a better way of achieving this? Maybe in jQuery? 回答1: This is how I would solve it: http://jsfiddle.net/77bMx/86/ Handles numpad input as well as standard number keys Works with backspace Will revert to 0.00 if you somehow manage to produce illegal input (like backspacing

UWP/WinRT: How to save and then restore a simple TextBox for resume from termination?

痞子三分冷 提交于 2019-12-22 09:47:52
问题 In this document describing the lifecycle of a Windows 10 UWP app, it states: Users now expect your app to remember its state as they multitask on their device. For example, they expect the page to be scrolled to the same position and all of the controls to be in the same state as before. By understanding the application lifecycle of launching, suspending, and resuming, you can provide this kind of seamless behavior. However, there doesn't appear to be much documentation on how this is

TextBox Word-Wrapping splitting string to lines

一个人想着一个人 提交于 2019-12-22 09:07:51
问题 This is my first time posting question on this amazing service, since today it has helped me a lot by just reading it. Currently, I'm making small C# application where I need to use a lot of TextBoxes. In TextBox Properties I have checked MultiLine and Word-Wrap functions. So when user enters text, it is displayed correctly in multiple lines. My problem is how can I get those lines, which are displayed on form, in list of strings, instead of one big string. I haven yet distinguished weather

Cancelling a WPF TextBox Changed Event

廉价感情. 提交于 2019-12-22 08:55:59
问题 I'm in the process of learning WPF coming from WinForms development. I have a TextChanged event assigned to one of my TextBox's in my WPF application. If the user enters invalid data, I want to be able to revert to the previous text value. In the old forms day, I would replace NewValue with OldValue, but it seems WPF doesn't work the same way. Any ideas on what I could do it achieve this? Am I just not thinking with WPF yet? Thanks. 回答1: You can do this two ways: Listen to the

Resize textbox and form size according to Text Length

家住魔仙堡 提交于 2019-12-22 08:55:11
问题 How can I automatically increase/decrease TextBox and Windows Form size according to text Length? 回答1: You can try overriding the OnTextChanged event, then changing the Width depending on the size of the text. protected override OnTextChanged(EventArgs e) { using (Graphics g = CreateGraphics()) { SizeF size = g.MeasureString(Text, Font); Width = (int)Math.Ceiling(size.Width); } base.OnTextChanged(e); } 回答2: Try this, it will also work... Here I have taken 100 as minimum width of textbox. "txt

How can I access custom Textbox attributes in ASP.Net?

北城以北 提交于 2019-12-22 08:30:10
问题 I am using/abusing CSS classes and custom html attributes to provide default data to a set of textboxes. The code-front for this looks like the following (with some supporting javascript to handle checking/setting the default data when the field is blank): <asp:TextBox ID="TXT_LenderName" class='defaultText' data-default='Institution Name' runat="server"></asp:TextBox> This works. I am working on the code-behind to process this form. I would like to be able to compare the value of the TXT

How can I access custom Textbox attributes in ASP.Net?

一个人想着一个人 提交于 2019-12-22 08:29:58
问题 I am using/abusing CSS classes and custom html attributes to provide default data to a set of textboxes. The code-front for this looks like the following (with some supporting javascript to handle checking/setting the default data when the field is blank): <asp:TextBox ID="TXT_LenderName" class='defaultText' data-default='Institution Name' runat="server"></asp:TextBox> This works. I am working on the code-behind to process this form. I would like to be able to compare the value of the TXT

How to Set WinForms Textbox to overwrite mode

依然范特西╮ 提交于 2019-12-22 06:24:36
问题 Is it possible to force a textbox in a windows forms application to work in "overwrite mode", i.e. have characters replaced when the user types instead of added? Otherwise, is there a standard way to get this behavior? 回答1: Try using a MaskedTextBox and set InsertKeyMode to InsertKeyMode.Overwrite. MaskedTextBox box = ...; box.InsertKeyMode = InsertKeyMode.Overwrite; 回答2: Standard way would be to select the existing text as you land in the textbox, then as the user types it will automatically

binding two VerticalScrollBars one to another

笑着哭i 提交于 2019-12-22 05:53:20
问题 I have two TextBoxes in the control , and I have in both of thems two VerticalScrollBar. I want to bind the VerticalScrollBars between them , if one goes up the secound will go also etc... Is it possible if so how i can do it ? Thanks 回答1: Not a real binding but it works: <TextBox Name="scrlTB1" Height="100" ScrollBar.Scroll="Scroll" ScrollViewer.VerticalScrollBarVisibility="Visible"/> <TextBox Name="scrlTB2" Height="100" ScrollBar.Scroll="Scroll" ScrollViewer.VerticalScrollBarVisibility=

WPF TextBox.Text with MultiBinding

▼魔方 西西 提交于 2019-12-22 04:43:34
问题 I've got Custom Control with a TextBox in the default Template. The Custom Control has these 2 dependency properties (among others): SelectedValue, NullText (text to appear in the TextBox when nothing is selected and the value is provided) I'd like to set the TextBox.Text with the NullText value when the SelectedValue null is and the NullText not null is. <TextBox.Text> <MultiBinding Converter="{StaticResource myConverter}"> <Binding RelativeSource="TemplatedParent" Path="SelectedValue"/>