how do i automate click events?

Liala Lahsan 1 Reputation point
2021-01-12T10:32:35.52+00:00

I would appreciate some help. I am trying to automate a program that requires a click event in a DataGridView . Here is a copy of the event.

Private Sub DataGridView1_CellContentClick(sender As Object,
e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,580 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-01-12T10:46:23.347+00:00

    Hi
    If I understand your question .........
    The best way is to put the code into a separate Sub and call that Sub from the event - and then it is available to be called from anywhere in scope.

        Private Sub DataGridView1_CellContentClick(sender As Object,
    e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
            SomeCode()
        End Sub
        Sub SomeCode()
            MessageBox.Show("Well well, so you finally managed to get out of your bed!")
        End Sub
    
    0 comments No comments