.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> Windows Application >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Create User defined Control - Numeric Textbox

Posted By:Vilas Gite       Posted Date: June 25, 2011    Points: 200    Category: Windows Application    URL: http://www.dotnetspark.com  

In this article I will show how to Create Numeric Textbox Control for windows application.
 

How to Create Numeric Textbox Control for windows application.

Let's create User Control.

Start Visual Studio 2005.

File -New-Project Type Visual C#



Select Windows Control Library from the Templates.

Specify Name with NumericTextBox and save on proper location.

Visual Studio Opens with Blank Control.



Right Click on Blank Control and View Code



Inherit TextBox control by modifying System.Windows.Forms.TextBox on UserControl.

Add code in control to restrict for non-numeric input by user.



Open UserControl1.Designer.cs from Solution Explorer and pass comment to the line, shown in below:



Now, Build - Build NumericTextBox.

Build Succeeded.

How to use User defined control NumericTextBox in windows Application

Create Windows Application with name PhoneDictionary.

 

Select ToolBox and Right Click on All Windows Forms then click on Choose items...



.NET Framework Components by default shown after Choose Items...



Now, browse to location where NumericTextBox.dll saved, select NumericTextBox.dll click open button and to close Choose Toolbox Items.



Add User Control to form.





Click on Start Debugging or press  F5.



There are only numeric input has been accepted in the shown textbox(NumericTextBox). User Control will be used in many more times in application/project in Visual Studio.

Thanks.

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend