Click here to Skip to main content
15,888,521 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: URL Rewriting Pin
Vasudevan Deepak Kumar15-Jun-07 3:15
Vasudevan Deepak Kumar15-Jun-07 3:15 
QuestionVS2005 Help Problem Pin
Mike Hankey10-Jun-07 16:49
mveMike Hankey10-Jun-07 16:49 
AnswerRe: VS2005 Help Problem Pin
Sathesh Sakthivel10-Jun-07 20:00
Sathesh Sakthivel10-Jun-07 20:00 
GeneralRe: VS2005 Help Problem Pin
Mike Hankey11-Jun-07 1:12
mveMike Hankey11-Jun-07 1:12 
GeneralRe: VS2005 Help Problem Pin
Sathesh Sakthivel11-Jun-07 2:38
Sathesh Sakthivel11-Jun-07 2:38 
QuestionValidation Pin
imran_Shaikh10-Jun-07 1:54
imran_Shaikh10-Jun-07 1:54 
AnswerRe: Validation Pin
Christian Graus10-Jun-07 13:49
protectorChristian Graus10-Jun-07 13:49 
QuestionMaskedTextBox + KeyEventArgs.SuppressKeyPress = bug? Pin
alex3_148-Jun-07 6:37
alex3_148-Jun-07 6:37 
My MaskedTextBox seems to have a bug in combination with the following function which gets called within the KeyDown event for all my TextBoxes:

<br />
private void dataEntryBehaviour(object sender, KeyEventArgs e)<br />
		{<br />
			if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Down)<br />
			{<br />
//				e.KeyCode = Keys.Down;	//to avoid the 1st input character disappearing bug<br />
										//NOT ALLOWED - READ ONLY!<br />
<br />
				//SuppressKeyPress is used to keep ENTER from being heard<br />
				e.SuppressKeyPress = true;	//this also sets e.Handled to true<br />
				this.SelectNextControl((Control)sender, true, true, true, true);<br />
			}<br />
			else if (e.KeyCode == Keys.Up)<br />
			{<br />
				e.SuppressKeyPress = true;	//this also sets e.Handled to true<br />
				this.SelectNextControl((Control)sender, false, true, true, true);<br />
			}<br />
		}<br />


The error is the following: After the user finishes entering the data, they can click a button to add the data into the database. The form then calls ResetText() on all the TextBoxes and the data entry begins anew. And here is where weird things happen: The first character typed into the MaskedTextBox disappears immediately after the second character input is typed (leaving a space behind). Also weird: If I don't set MaskedTextBox.SelectionStart = 1, the first character typed appears before what the Mask should allow ("(000) 000-0000").

Note that even if I set MaskedTextBox.SelectionStart = 1, which will display the first character to appear after the "(" literal, it'll still disappear after the second character is typed.

<br />
Attempting to type "3056667777" results:<br />
<br />
Without setting MaskedTextBox.SelectionStart = 1, "(056) 667-777_"<br />
<br />
With setting MaskedTextBox.SelectionStart = 1, "(_05) 666-7777"<br />
<br />
So, essentially, to get the results I want I'd have to not set MaskedTextBox.SelectionStart = 1, and type "33056667777".<br />


Now, this error only occurs on in my MaskedTextBoxes (not my vanilla TextBoxes) and only when ENTER is pressed to navigate away from that particular control. Also, if I use KeyEventArgs.Handled instead KeyEventArgs.SuppressKeyPress - the problem disappears. Unfortunately, I then get a "Windows XP Ding" every time I hit ENTER.

What am I doing wrong or is this just a bug with MS' new control?

Alex

QuestionCustom DataGridViewComboBoxColumn Pin
MaverickDQ8-Jun-07 5:01
MaverickDQ8-Jun-07 5:01 
AnswerRe: Custom DataGridViewComboBoxColumn Pin
Robert Rohde8-Jun-07 21:48
Robert Rohde8-Jun-07 21:48 
GeneralRe: Custom DataGridViewComboBoxColumn Pin
MaverickDQ8-Jun-07 22:44
MaverickDQ8-Jun-07 22:44 
QuestionWorkflowFoundation: How to (un)persist types from different assembly versions Pin
Lord Skeletor8-Jun-07 2:31
Lord Skeletor8-Jun-07 2:31 
AnswerRe: WorkflowFoundation: How to (un)persist types from different assembly versions Pin
Kevin McFarlane8-Jun-07 6:37
Kevin McFarlane8-Jun-07 6:37 
GeneralRe: WorkflowFoundation: How to (un)persist types from different assembly versions Pin
Lord Skeletor10-Jun-07 23:18
Lord Skeletor10-Jun-07 23:18 
QuestionString to Byte Array Conversion Pin
M. J. Jaya Chitra8-Jun-07 1:21
M. J. Jaya Chitra8-Jun-07 1:21 
AnswerRe: String to Byte Array Conversion Pin
szukuro8-Jun-07 1:37
szukuro8-Jun-07 1:37 
AnswerRe: String to Byte Array Conversion Pin
Thomas Stockwell12-Jun-07 4:27
professionalThomas Stockwell12-Jun-07 4:27 
GeneralRe: String to Byte Array Conversion Pin
WhiteGirl2325-Jun-07 0:47
WhiteGirl2325-Jun-07 0:47 
Questionremoting service Pin
hoang minh khoi8-Jun-07 0:19
hoang minh khoi8-Jun-07 0:19 
AnswerRe: remoting service Pin
Manas Bhardwaj8-Jun-07 0:28
professionalManas Bhardwaj8-Jun-07 0:28 
Questioncan you help me Pin
hoang minh khoi8-Jun-07 0:09
hoang minh khoi8-Jun-07 0:09 
AnswerRe: can you help me Pin
szukuro8-Jun-07 1:42
szukuro8-Jun-07 1:42 
GeneralRe: can you help me Pin
hoang minh khoi8-Jun-07 15:14
hoang minh khoi8-Jun-07 15:14 
QuestionInstall two setup at same time Pin
Suhail Shahab7-Jun-07 20:46
Suhail Shahab7-Jun-07 20:46 
AnswerRe: Install two setup at same time Pin
Manas Bhardwaj8-Jun-07 0:27
professionalManas Bhardwaj8-Jun-07 0:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.