1 Attachment(s)
[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
Re: Link in datagrid did not responce..
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
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..
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
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
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