Windows.Forms.Datagrid - Hyperlink Column: How to?

Posted on 2004-09-16
Last Modified: 2010-07-27
Hi, I am coding a Hyperlink column for the Windows.Forms.Datagrid as follows:

I have derived from System.Windows.Forms.DataGridTextBoxColumn
I have overridden the paint method
I have a LinkLabel that I can use.

Now then, not worring too much about the value of the url, how do I access the cells value and paint the LinkLabel?
I presume that I can use 'this.TextBox.Text' to get the value - is this correct?

Question by:Daeljan
  • 3
LVL 10

Expert Comment

Comment Utility
U can try this

Search for "How do I display a column of buttons such as pushbuttons or combobox buttons? "

U can use pushbuttons as linkbutton


Author Comment

Comment Utility
How do I use push buttons as a link button?

The examples displayed are drawing bitmaps of buttons to the screen. Given that a LinkLabel has a specific look and behaviour, I don't want to redesign the wheel and emulate it, I just want to use it.

Any ideas?


Author Comment

Comment Utility
I would like to close this question as I have solved the problem myself, and I have it all working as I wanted.

To make a custom column of any kind, create a new column type based on System.Windows.Forms.DataGridColumnStyle.
This column should maintain an array of controls of the type you want to display.
You have to add each control in the array of controls to the new column (in a loop):

In the paint method you can set properties for each control:
LinkLabel linkLabel = controlArray[rowNum];
linkLabel.Text = GetColumnValueAtRow(source, rowNum).ToString();

The controls will paint themselves - don't worry about them.

A search in Google for System.Windows.Forms.DataGridColumnStyle will bring up many articles to help.


Author Comment

Comment Utility
I have posted in the Community support section requesting a refund because I answered my own question.


Accepted Solution

ee_ai_construct earned 0 total points
Comment Utility
Question answered by asker or dialog valuable.
Closed, 200 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now