Solved

VB2010:  How to modify text in a datagridview.

Posted on 2010-08-27
2
1,244 Views
Last Modified: 2013-11-27
I imported data into my DataGridView in my Visual Basic 2010 Windows application.  The table looks like this:
router-1   10.20.21.145  KC
router-2   10.20.21.146  St. Louis
router-3   10.20.21.147  Columbia

Now I want to:
1.) convert the ip addresses into hyperlinks pointing to the same address,
2.) create an "on_click" event for the city names, and
3.) modify the "router-x" text.

I know it's a lot to ask, and a tutorial would be useful, but I haven't found what I need yet.  Any help will be appreciated.  This is the my first time using a datagridview.
Imports System.Data

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, _

                ByVal e As System.EventArgs) Handles Button1.Click

        Try

            Dim MyConnection As System.Data.OleDb.OleDbConnection

            Dim DtSet As System.Data.DataSet

            Dim MyCommand As System.Data.OleDb.OleDbDataAdapter

            MyConnection = New System.Data.OleDb.OleDbConnection _

            ("provider=Microsoft.Jet.OLEDB.4.0;" & _

            " Data Source='c:\testfile.xls'; " & _

             "Extended Properties=Excel 8.0;")

            MyCommand = New System.Data.OleDb.OleDbDataAdapter _

                ("select * from [ Vlan - 32$]", MyConnection)

            MyCommand.TableMappings.Add("Table", "TestTable")

            DtSet = New System.Data.DataSet

            MyCommand.Fill(DtSet)

            DataGridView1.DataSource = DtSet.Tables(0)

            MyConnection.Close()

        Catch ex As Exception

            MsgBox(ex.ToString)

        End Try

    End Sub

End Class

Open in new window

0
Comment
Question by:motokent
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 33548998
The first thing that you need to know about is the DataGridViewLinkColumn type:

DataGridViewLinkColumn Class
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewlinkcolumn.aspx
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33549495
About your First Question the answer is already given Form LearnOne...
About the second and third part of your question
Click Event ......What Exactly do you need
....and Modify text.....Also what do you wnat....
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

11 Experts available now in Live!

Get 1:1 Help Now