custom control

Hi all
I am newbie in Dotnet. i want to create custom control for text box and button to have the same look and feel across the project..
I want to set the color,font, width for that control
how can i create it
thanks
pr
LVL 2
pr_rAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RonaldBiemansCommented:
just choose add new item, choose usercontrol, put a textbox and a button on your control, set the properties you want,

In the toolbox under your the my user controls tab you will see your usercontrol and you can drag that to any form you want in your solution
pr_rAuthor Commented:
i  need a text boxcntrl alone and button contrl alone
RonaldBiemansCommented:
In that case create a new project, choose class library

put something like this in the class

Imports System.Drawing
Imports System.Windows.Forms

Public Class mybutton
    Inherits Button

    Sub New()
        Dim myFont As New Font("Arial", 16)
        Me.BackColor = Color.Red
        Me.ForeColor = Color.Yellow
        Me.Width = 40
        Me.Height = 20
        Me.Font = myFont
    End Sub

End Class


then build it, then goto the toolbox, right click on the my user controls tab, choose add remove items, choose browse, locate yourclass.dll (probably in the bin directory of your project) double click it, your button is now in the toolbox and you can drag it to your form.

do the same for your textbox

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

pr_rAuthor Commented:
i created a class library as u said.. the is in one class1. vb. i double clicked tried pasting your code it gives error in import statement
RonaldBiemansCommented:
Ah sorry you have to reference the

system.windows.form and
system.drawing

choose add references and select the 2 I mentioned above
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.