在MySQL Datagridview中将单元格内容转换为超链接 [英] Convert Cell Content to Hyperlink in MySQL Datagridview

查看:239
本文介绍了在MySQL Datagridview中将单元格内容转换为超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在datagridview窗体中有一个MySQL表(内置于视觉基础)。表中的列在每行中都有电子邮件地址。我希望用户能够点击单元格,它将自动从Outlook打开一封电子邮件,其中电子邮件地址位于电子邮件to:部分中的单元格中。



我没有成功将其添加到查询和Databindingcomplete类中。

 code>从t1选择姓名,电子邮件,电话,地址,名称如A%


解决方案

您可以使用datagridview单元格单击事件。

  Private Sub MyDataGridView_CellClick(ByVal发送方作为对象,ByVal e As DataGridViewCellEventArgs)处理MyDataGridView.CellClick 
如果MyDataGridView.Columns(e.ColumnIndex).HeaderText =email,然后
Dim selectedEMailCell As DataGridViewCell = MyDataGridView.Rows(e.RowIndex) .Cells(e.ColumnIndex)
如果selectedEMailCell.Value IsNot Nothing然后
System.Diagnostics.Process.Start(mailto:& selectedEMailCell.Value.ToString)
End If
结束If
End Sub


I have a MySQL table in datagridview windows form (built in visual basic). Once column in my table has email addresses in every row. I would like the users to be able to click on the cell and it will automatically open an email message from Outlook with the email address in the cell populated in the 'to:' section of email.

I've been unsuccessful adding it into the query and in the class Databindingcomplete.

select name, email, phone, address from t1 where name is like 'A%'

解决方案

You can use the datagridview cell click event.

Private Sub MyDataGridView_CellClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles MyDataGridView.CellClick
  If MyDataGridView.Columns(e.ColumnIndex).HeaderText = "email" then        
    Dim selectedEMailCell As DataGridViewCell = MyDataGridView.Rows(e.RowIndex).Cells(e.ColumnIndex)
    If selectedEMailCell.Value IsNot Nothing Then       
      System.Diagnostics.Process.Start("mailto:" & selectedEMailCell.Value.ToString)
    End If
  End If
End Sub

这篇关于在MySQL Datagridview中将单元格内容转换为超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆