Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
Question.net test question bank creator Pin
rajantawate1(http//www.tawateventures.com21-May-07 7:02
rajantawate1(http//www.tawateventures.com21-May-07 7:02 
AnswerRe: .net test question bank creator Pin
Not Active21-May-07 7:09
mentorNot Active21-May-07 7:09 
QuestionHow to take mysql backup through .Net Pin
Joe Rozario21-May-07 6:43
Joe Rozario21-May-07 6:43 
AnswerRe: How to take mysql backup through .Net Pin
~~~Johnny~~~21-May-07 8:52
~~~Johnny~~~21-May-07 8:52 
QuestionEXIF Data - How to compute APEX values? Pin
matthias s.21-May-07 6:37
matthias s.21-May-07 6:37 
QuestionHow can I validate NumericUpDown while editing Pin
TooDoo21-May-07 5:55
TooDoo21-May-07 5:55 
AnswerRe: How can I validate NumericUpDown while editing Pin
Not Active21-May-07 6:14
mentorNot Active21-May-07 6:14 
AnswerRe: How can I validate NumericUpDown while editing Pin
Are Jay21-May-07 7:52
Are Jay21-May-07 7:52 
Try this:
private void textBox1_KeyDown( object sender, KeyEventArgs e ) {

   if ( e.Control ) {

      switch ( e.KeyCode ) {

         case Keys.X:

         case Keys.C:

            break;

         default:

            e.SuppressKeyPress = true;

            break;

      }

   } else {

      switch ( e.KeyCode ) {

         case Keys.NumPad0:

         case Keys.NumPad1:

         case Keys.NumPad2:

         case Keys.NumPad3:

         case Keys.NumPad4:

         case Keys.NumPad5:

         case Keys.NumPad6:

         case Keys.NumPad7:

         case Keys.NumPad8:

         case Keys.NumPad9:

         case Keys.D0:

         case Keys.D1:

         case Keys.D2:

         case Keys.D3:

         case Keys.D4:

         case Keys.D5:

         case Keys.D6:

         case Keys.D7:

         case Keys.D8:

         case Keys.D9:

         case Keys.NumLock:

         case Keys.Left:

         case Keys.Right:

         case Keys.Back:

         case Keys.Delete:

            break;

         default:

            e.SuppressKeyPress = true;

            break;

      }

   }

}



private void textBox1_KeyPress( object sender, KeyPressEventArgs e ) {

   Int16 num;

   if ( Int16.TryParse( textBox1.Text.Trim() + e.KeyChar.ToString(), out num ) ) {

      if ( !( num <= 10 && num >= 0 ) ) {

         e.Handled = true;

         // Handle the key press event and display nothing.

      }

   }

}


If it is a windows application.

I'm listening but I only speak GEEK.

GeneralRe: How can I validate NumericUpDown while editing Pin
TooDoo21-May-07 23:08
TooDoo21-May-07 23:08 
GeneralRe: How can I validate NumericUpDown while editing Pin
Are Jay22-May-07 3:36
Are Jay22-May-07 3:36 
GeneralRe: How can I validate NumericUpDown while editing Pin
TooDoo22-May-07 4:02
TooDoo22-May-07 4:02 
GeneralRe: How can I validate NumericUpDown while editing Pin
Are Jay22-May-07 4:22
Are Jay22-May-07 4:22 
QuestionAdd items to Menu at Runtime Pin
Rick van Woudenberg21-May-07 5:28
Rick van Woudenberg21-May-07 5:28 
AnswerRe: Add items to Menu at Runtime Pin
led mike21-May-07 5:52
led mike21-May-07 5:52 
QuestionNightmare StreamReader! Pin
Lordveralix21-May-07 5:18
Lordveralix21-May-07 5:18 
AnswerRe: Nightmare StreamReader! Pin
Sathesh Sakthivel21-May-07 5:23
Sathesh Sakthivel21-May-07 5:23 
GeneralRe: Nightmare StreamReader! Pin
Lordveralix21-May-07 5:26
Lordveralix21-May-07 5:26 
AnswerRe: Nightmare StreamReader! Pin
Bekjong21-May-07 5:26
Bekjong21-May-07 5:26 
AnswerRe: Nightmare StreamReader! Pin
Dave Herren21-May-07 5:45
Dave Herren21-May-07 5:45 
AnswerRe: Nightmare StreamReader! Pin
jayart21-May-07 6:29
jayart21-May-07 6:29 
AnswerRe: Nightmare StreamReader! Pin
Dave Kreskowiak21-May-07 6:31
mveDave Kreskowiak21-May-07 6:31 
QuestionAdding and Removing Form Controls Using Code Pin
Joseph Stanish21-May-07 4:27
Joseph Stanish21-May-07 4:27 
AnswerRe: Adding and Removing Form Controls Using Code Pin
Guffa21-May-07 4:30
Guffa21-May-07 4:30 
GeneralRe: Adding and Removing Form Controls Using Code Pin
Joseph Stanish21-May-07 4:36
Joseph Stanish21-May-07 4:36 
AnswerRe: Adding and Removing Form Controls Using Code Pin
Bekjong21-May-07 4:41
Bekjong21-May-07 4:41 

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.