C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old December 29th, 2002, 12:13 PM
gicio gicio is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 90 gicio User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 30 sec
Reputation Power: 6
Question [C#] Validation class for events?

Hi,

I develop an application that have 20 windows forms with many TextBoxes.
All TextBoxes have the same validation...
I write in all classes the same validation like that:



Code:
		
		//if the user press a key down at txtDisplacement we check which one was pressed down
		#region KeyDownInTxtDisplacement code
		private void KeyDownInTxtDisplacement(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			CheckWhichKeyDown(e);
		}
		#endregion



		//if the user press a key down at txtModel we check which one was pressed down
		#region KeyDownInTxtModel code
		private void KeyDownInTxtModel(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			CheckWhichKeyDown(e);
		}
		#endregion



		//we check which key is pressed
		//if key Enter or Return or Tab is pressed
		//we go throw DoWhenOneTextBoxIsMarkedRed()
		#region CheckWhichKeyDown code
		private void CheckWhichKeyDown(System.Windows.Forms.KeyEventArgs e)
		{
			if(e.KeyCode==Keys.Enter || e.KeyCode==Keys.Return || e.KeyCode==Keys.Tab)
			{
				ValidateThis();
			}		
		}
		#endregion



		//when special key is press we enable the button
		#region ValidateThis code
		private void ValidateThis()
		{
			cmdAddToDataBase.Enabled = true;
		}
		#endregion





CheckWhichKeyDown and ValidateThis should be in one validation class.
How I can write a validation class that validate ALL TextBoxes from all classes.
Any ideas?
Or do you know some sample validation classes available on www?


gicio

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > [C#] Validation class for events?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway