textbox

How to append text to a TextBox?

隐身守侯 提交于 2019-12-29 08:08:30
问题 I think the following code should be self-explanatory. #include <Windows.h> static HWND textBoxInput; static HWND button; static HWND textBoxOutput; LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR cmdLine,int nCmdShow) { HWND hMainWindow; WNDCLASS wc = {}; wc.lpfnWndProc = WindowProc; wc.lpszClassName = "Main's window class"; wc.hInstance = hInstance; RegisterClass(&wc); hMainWindow =

Can you replace characters in a textbox as you type?

故事扮演 提交于 2019-12-29 07:31:25
问题 We are looking for a way to make a textbox replace certain characters as a person types in it. Note, we are focusing on the control itself, not bindings, viewmodels, etc. For the sake of this question, assume there is a window with a textbox sitting in the middle of it and nothing else. No data, no viewmodel, no bindings, etc. I've updated the question because it seems all the answers below keep focusing on bindings, dependency properties, coersion, etc. While I appreciate the suggestions, as

Custom WPF DatePickerTextBox Template

夙愿已清 提交于 2019-12-29 06:48:07
问题 I am trying to use a custom TextBox in the DatePicker control, but I can't get the date to bind from the popup calendar to the TextBox . I don't want to have to style the entire DatePicker unless I have to, and the DatePickerTextBox has its own control, so there must be a way to only alter it. The code below is what I have as a start: <Style TargetType="{x:Type DatePickerTextBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DatePickerTextBox}"> <TextBox x

Auto-scrolling text box uses more memory than expected

偶尔善良 提交于 2019-12-29 03:21:31
问题 I have an application that logs messages to the screen using a TextBox. The update function uses some Win32 functions to ensure that the box automatically scrolls to the end unless the user is viewing another line. Here is the update function: private bool logToScreen = true; // Constants for extern calls to various scrollbar functions private const int SB_HORZ = 0x0; private const int SB_VERT = 0x1; private const int WM_HSCROLL = 0x114; private const int WM_VSCROLL = 0x115; private const int

AS3 Textbox Change Event Not Firing

六眼飞鱼酱① 提交于 2019-12-29 01:44:13
问题 I built a quiz game with a cartoon question bubble. The bubble is re sized to the length of the question. I want to a change event on the dynamic textbox to call a function that changes the size of the question bubble. However, the change event is never called when my textbox value is modified dynamically from code. question_txt.addEventListener(Event.CHANGE, setTextBubbleSize); function setTextBubbleSize(event:Event):void { trace("QUESTION TEXT CHANGED"); textBubble_mc.height = 30 + question

Get integer from Textbox

自作多情 提交于 2019-12-28 18:13:52
问题 I am very new to C# and this question might sound very stupid. I wonder how I'm going get the integer(user's input) from the textBox1 and use it in if else statement? Please give some examples 回答1: You need to parse the value of textbox.Text which is a string to int value. You may use int.TryParse, or int.Parse or Convert.ToInt32. TextBox.Text property is of string type. You may look at the following sample code. int.TryParse This will return true if the parsing is successful and false if it

Null Password Char in Winform [duplicate]

天涯浪子 提交于 2019-12-28 06:48:36
问题 This question already has answers here : How can I unmask password text box and mask it back to password? (7 answers) Closed 4 years ago . I have a textbox in a c# windows form i am having problems in assigning a null values to a PasswordChar . What i want to do is that if a checkbox is checked then the PasswordChar should be null i.e the actual text should be displayed else the PasswordChar should be * . This what i have tried private void checkBox1_CheckedChanged(object sender, EventArgs e)

Setting maxlength of textbox with JavaScript or jQuery

↘锁芯ラ 提交于 2019-12-28 04:00:11
问题 I want to change the maxlength of a textbox with JavaScript or jQuery: I tried the following but it didn't seem to help: var a = document.getElementsByTagName('input'); for(var i=0; i<a.length; i++) { if((a[i].type!= 'radio')||(a[i].type!= 'checkbox')) a[i].maxlength = 5; } document.getElementsByTagName('input')[1].maxlength="3"; $().ready(function() { $("#inputID").maxlength(6); }); What am I doing wrong? 回答1: Not sure what you are trying to accomplish on your first few lines but you can try

Paste Event in a WPF TextBox

孤人 提交于 2019-12-28 02:26:28
问题 I have created a custom control inheriting TextBox . This custom control is a numeric TextBox , only supporting numbers. I am using OnPreviewTextInput to check each new character being typed to see if the character is a valid input. This works great. However, if I paste the text into the TextBox , OnPreviewTextInput is not fired. What is the best way to capture pasted text in a TextBox ? Also, I have a problem when the back space is pressed, I can't figure out what event this will fire.

WPF: simple TextBox data binding

那年仲夏 提交于 2019-12-27 17:08:31
问题 I have this class: public partial class Window1 : Window { public String Name2; public Window1() { InitializeComponent(); Name2 = new String('a', 5); myGrid.DataContext = this; } // ... } And I want to display the string Name2 in the textbox. <Grid Name="myGrid" Height="437.274"> <TextBox Text="{Binding Path=Name2}"/> </Grid> But the string isn't displayed. Also, if the string Name2 is updated periodically using a TimerCallback , do I need to do anything to make sure the textbox is updated