Question How to copy text from MessageBox?

raysefo

Well-known member
Joined
Jul 21, 2010
Messages
207
Programming Experience
Beginner
Hi,

I have a DataGridView and when user clicks on a row, a messagebox pops up with some value. I would like to copy some portion of this text from the messagebox. Is there a way to do it?

Thanks in advance.

Best Regards.

Sample code:
VB.NET:
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        Dim coupon_details As String = Nothing
        Dim value As Object = DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
        coupon_details = value.ToString
        If (Not TypeOf value Is DBNull) Then
            MessageBox.Show(coupon_details, _
                           "Coupon Details.", _
                   MessageBoxButtons.OK, _
                   MessageBoxIcon.Information)
        End If
    End Sub
 
Last edited by a moderator:
Back
Top