Solved

Datagrid View Contents Format Control and Event Handling

Posted on 2012-04-01
2
278 Views
Last Modified: 2012-04-02
Hi

I have the following VB.NET code to populate a gridview (in a windows application form):

        Dim NotfData As New DataSet
        NotfData = MC.DB(NoftDataSQL()) 'this will populate "NotfData.Tables(0)" with Data

        Notf_Grid.Columns.Add("NotfCount", "No.")
        Notf_Grid.Columns.Add("NotfLink", "Notification Link")
        Notf_Grid.Columns.Add("NotfID", "Notification ID")

        For i = 0 To NotfData.Tables(0).Rows.Count - 1
            Notf_Grid.Rows.Add((i + 1).ToString, NotfData.Tables(0).Rows(i).Item("Notf. Link"), NotfData.Tables(0).Rows(i).Item("Notf. ID"))
        Next

        Notf_Grid.Columns(0).AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells
        Notf_Grid.Columns(1).AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells
        Notf_Grid.Columns(2).Visible = False

Open in new window


I have three questions:

Question 1: How can I make Notf_Grid.Columns(1) formats its rows values into Hyperlinks instead of pure text?

Question 2: How can I add an (OnClick) event handler for each row/cell of this [Notf_Grid]?

Question 3: How can I format the text (bold, italic, underline ... etc.) of any cell in this [Notf_Grid]
0
Comment
Question by:alfardan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37794899
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37795286
1) Check the AddLinkColumn method in below example
    http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcomboboxcolumn%28VS.90%29.aspx#Y700

2) Handle the CellClick and SelectionChanged events

3) Use the CellFormatting event
    http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellformatting.aspx
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

687 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