Solved

Datagrid View Contents Format Control and Event Handling

Posted on 2012-04-01
2
273 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adding queries and macros to many Microsoft Access Databases. 7 74
Help with sorting data in Listbox using VB.NET 3 53
Tool Box 2 35
Not showing page correctly 3 31
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

896 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

15 Experts available now in Live!

Get 1:1 Help Now