Results 1 to 4 of 4

Thread: List of websites + hyperlinks

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    List of websites + hyperlinks

    I am in need of advice. I have a list of domains and I wanted to find out what the best course of method was to display this so the user can see the link and click on it. I have roughly 300_ domains so doing the link label is out of the question.

    I wanted to create some sort of grid but then wondered if I was able to have hyperlinks in the grid, I didnt want to do an xml cos I didnt want any files outside of the main application and wanted everything internal.

    Can anyone post some suggestions please.

    Thank you.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: List of websites + hyperlinks

    The DataGridView has a standard column type specifically for displaying hyperlinks.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: List of websites + hyperlinks

    I currently have a datagrid set up but the links are in a XML file which is annoying when I want to bundle it. The current grid has 3 columns, name, name, website, but the link is like a text link and not clickable, is there an easy way for me to contain the links in the XML to within the application so the data displayed in the 3rd column has a clickable hyperlink?

    Here is my code for grabbing the XML

    Code:
    Imports System.Xml
    Imports System.Data
    
    Public Class Form1
    
        Dim ds As New DataSet
    
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim xmlFile As XmlReader
            xmlFile = XmlReader.Create("C:\Projects\PhoneData.xml", New XmlReaderSettings())
    
            ds.ReadXml(xmlFile)
    
            DataGridView1.DataSource = ds.Tables(0)
    
        End Sub
    
        Private Sub btnMobileDeviceFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMobileDeviceFilter.Click
            ds.Tables(0).DefaultView.RowFilter = "[Mobile_Phone_Type] like '%" & tbMobileDevice.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
    
        Private Sub btnSimType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimType.Click
            ds.Tables(0).DefaultView.RowFilter = "[SIM_Type] like '%" & tbSIMType.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub
    
        Private Sub btnWebsiteLinkFilter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWebsiteLinkFilter.Click
            ds.Tables(0).DefaultView.RowFilter = "[Website_Link] like '%" & tbWebsiteLink.Text & "%'"
            DataGridView1.DataSource = ds.Tables(0)
        End Sub

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: List of websites + hyperlinks

    As I said, the DataGridView (NOT DataGrid, which is a different control) has a standard column type specifically for hyperlinks. It's not going to add one by default though, because it has no idea that the text in that column is supposed to be links. If you want a link column then you have to add one yourself, which you would do in the designer. You can add just that column and let the grid add the others or you can add all the columns yourself. I'd probably go with the second option. If you add columns in the designer then you must set their DataPropertyName so they know what to bind to.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width