3 Replies - 10045 Views - Last Post: 19 October 2009 - 05:53 AM Rate Topic: -----

#1 arshia  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 1
  • Joined: 12-October 09

How to make your own control in vb.net?

Posted 19 October 2009 - 04:18 AM

How to make your own control in vb.net?
Is This A Good Question/Topic? 1
  • +

Replies To: How to make your own control in vb.net?

#2 janne_panne  Icon User is offline

  • WinRT Dev
  • member icon

Reputation: 428
  • View blog
  • Posts: 1,047
  • Joined: 09-June 09

Re: How to make your own control in vb.net?

Posted 19 October 2009 - 04:42 AM

There are few ways to do it.

First way is to create your own class which derives from Control class.

Second is to create your own class which derives from existing control, like Button. This is good if you want to just make small modifications to an existing control. For example remove the panel from TabControl where all the tabs' headers are.

Third is to create a control which derives from UserControl. This is probably the easiest way and that's what I have used the most. I have not derived from Control class yet because then you'd have to do all the drawings etc which is maybe powerful as it lets you have lots of influence over your control but it is also slow to develop.
In Visual Studio just right click your project and select "User Control..." option from the menu. It will also open a visual editor where you can drag other existing controls if you need them. This is good way to also organize your project: you don't have to write all the code behind Form because you can divide the Form into UserControls and have lots of code behind them too. It was a pain in the butt to update a project which had tabcontrol on a form and all the code was written there on the same file. After dividing each tab into UserControl and writing code there, the updating became a lot easier.
Was This Post Helpful? 0
  • +
  • -

#3 dzone41  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 46
  • View blog
  • Posts: 216
  • Joined: 21-August 09

Re: How to make your own control in vb.net?

Posted 19 October 2009 - 04:50 AM

Type your question into google and take your pick of :

Results 1 - 10 of about 3,990,000 for create a custom control in VB.Net. (0.32 seconds)
Was This Post Helpful? 0
  • +
  • -

#4 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2271
  • View blog
  • Posts: 9,500
  • Joined: 29-May 08

Re: How to make your own control in vb.net?

Posted 19 October 2009 - 05:53 AM

There two tutorials cover this topic.
Custom Controls
Making a User Control
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1