Click here to Skip to main content
13,551,034 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to create custom control linkbutton from the linklabel for the windows form application.
how it can be possible.
Posted 11-Jan-13 6:02am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Surely, you didn't mention any specific worries, so perhaps start by reading this: Developing Custom Windows Forms Controls with the .NET Framework[^]

and few examples:
- Divider Panel - A tutorial on creating a custom Windows Forms control from Start to Toolbox[^]
- Writing your Custom Control: step by step[^]

To use the same event handler for multiple link labels you could have something like:
linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(AllLinkLabels_LinkClicked);
linkLabel2.LinkClicked += new LinkLabelLinkClickedEventHandler(AllLinkLabels_LinkClicked);
linkLabel3.LinkClicked += new LinkLabelLinkClickedEventHandler(AllLinkLabels_LinkClicked);

And the event handler itself could be modified from the following:
private void AllLinkLabels_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {

Of course it needs more logic, exception handling etc, but that would be a start.
algioethqnbalkerunb 11-Jan-13 12:24pm
+5. Well put.
wendelius 11-Jan-13 12:51pm
Thanks Marcus :)
tusharkaushik 11-Jan-13 14:11pm
but i want that if user clicked at newly created inherited control linkbutton , the given url will open in an browser.
can it possible!
algioethqnbalkerunb 11-Jan-13 14:47pm
Of course it is possible. Just write the code to do that in the click handler.
wendelius 11-Jan-13 15:00pm
Based on the description, do you really need an inherited control for this? Why not just set the links on each linklabel and then register the same eventhandler for all linklabels. See the updated answer.
tusharkaushik 11-Jan-13 15:23pm
ya! I i really need inherited control.
But i wanna create link button inherited from button control.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180515.1 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100