Results 1 to 7 of 7

Thread: [RESOLVED] Link in datagrid did not responce..

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2007
    Posts
    839

    Resolved [RESOLVED] Link in datagrid did not responce..

    Hi! somebody help me please..

    I have datagrid which has field where user can view the enter link from textboc into the datagrid, the error is when i click the link the datagrid it didn't responce..

    how can i make it the link well responce when it hit or click..?

    example in the link in the datagrid is www.vbforums.com i will open a internet www.vbforums.com, if i put a [B]c:\MyData\For viewing[/B] it will open the the found in this c:\MyData\For viewing

    see image below

    please help
    Attached Images Attached Images  

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Link in datagrid did not responce..

    Please mark you thread resolved using the Thread Tools as shown

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Link in datagrid did not responce..

    And one WebBrowser Control in your form and

    Code:
     Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick
            Dim sUrl As String = DataGridView2.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString
            WebBrowser1.Navigate(sUrl)
        End Sub

    You could check for the valid link before navigating to them
    Please mark you thread resolved using the Thread Tools as shown

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2007
    Posts
    839

    Re: Link in datagrid did not responce..

    what if it's not a web browser found on that cell.. what if it's path of the file from the server..? exam the cell contains \\pc1\data\group1\lectures

    how to make when i click the cell the path inside the cell well open..

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2007
    Posts
    839

    Re: Link in datagrid did not responce..

    nothing happen i tried to do this codes below..

    Code:
    
        Private Function IsANonHeaderLinkCell(ByVal cellEvent As _
            DataGridViewCellEventArgs) As Boolean
    
            If TypeOf DataGridView1.Columns(cellEvent.ColumnIndex) _
                Is DataGridViewLinkColumn _
                AndAlso Not cellEvent.RowIndex = -1 Then _
                Return True Else Return False
    
        End Function
    
        Private Function IsANonHeaderButtonCell(ByVal cellEvent As _
            DataGridViewCellEventArgs) As Boolean
    
            If TypeOf DataGridView1.Columns(cellEvent.ColumnIndex) _
                Is DataGridViewButtonColumn _
                AndAlso Not cellEvent.RowIndex = -1 Then _
                Return True Else Return (False)
    
        End Function
    
    
    
        Public Event CellContentClick As DataGridViewCellEventHandler
        Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick
            If IsANonHeaderLinkCell(e) Then
                MoveToLinked(e)
            End If
    
        End Sub
    Please help

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2007
    Posts
    839

    Re: Link in datagrid did not responce..

    please help i think i don't understand what it mean in the code above.. please help... how to do when i click the cell it run the path found in the cell.. please help..
    ex. when the linkcolumn cell has C:\Program Files\
    when i click the cell it will open the C:\Program Files folder
    Last edited by edgarbenilde; Feb 5th, 2009 at 10:07 PM.

  7. #7
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Link in datagrid did not responce..

    For Opening a Physical Folder you have to Use Process.Start Method.

    Code:
        Private Sub DataGridView2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellContentClick
            Dim sUrl As String = DataGridView2.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString
            Process.Start(sUrl)
        End Sub

    Hope this helps
    Please mark you thread resolved using the Thread Tools as shown

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