Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

Custom Control in c#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
anant - 13 Mar 2008 06:12 GMT
Can anyone tell me how can i write on a custom control area using
keyboard.
i.e i  want that custom control to work like textbox, but i m not
using (inheriting) textbox instead
i m creating my control using UserControl

thanks in advance.
Peter Duniho - 13 Mar 2008 07:14 GMT
> Can anyone tell me how can i write on a custom control area using
> keyboard.
> i.e i  want that custom control to work like textbox, but i m not
> using (inheriting) textbox instead
> i m creating my control using UserControl

UserControl is a scrollable container that is usually used for putting  
other controls inside it.  Unless you are specifically needing that  
behavior for some reason, you should inherit Control, rather than  
UserControl (I know, the name's confusing...but UserControl isn't a  
general-purpose base class for custom controls).

As far as implementing a text box goes, it depends on what you want to  
do.  How much of the functionality that TextBox has do you want to  
create?  How much work are you willing to put into it?  Even for an  
experienced programmer, this is a good week-long project just to get all  
of the various features implemented, never mind tested and debugged.  If  
you just want a subset, it could be a lot easier, depending on what you  
actually want to do.

As for how to go about it, you'll need to override things like  
OnKeyDown(), OnPaint(), etc. to handle key input and drawing the control.  
Short of actually writing the control for you and showing you code, I  
don't know how else to answer the question.  If you're unfamiliar with  
writing custom controls, I'll suggest that implementing a text box may not  
be a good first effort.  You might want to write a simpler custom control  
first, learning each part as you go.

Pete

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.