simmulate real rowEnter on DataGridView object.

  • Thread starter Thread starter Mr. X.
  • Start date Start date
M

Mr. X.

Hello.
I want to do by force : RowEnter event of DataGridViewObject.

I made a function on my code :
Public Sub ReEnter()
Invoke(New EventHandler(AddressOf dg_RowEnter))
End Sub

Where dg_RowEnter is the event :
Private Sub dg_RowEnter(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles Me.RowEnter


Why I don't reach the sub : dg_RowEnter, as I have described in the code
above?

Thanks :)
 
Am 24.04.2010 10:04, schrieb Mr. X.:
Hello.
I want to do by force : RowEnter event of DataGridViewObject.

I made a function on my code :
Public Sub ReEnter()
Invoke(New EventHandler(AddressOf dg_RowEnter))
End Sub

Where dg_RowEnter is the event :
Private Sub dg_RowEnter(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles Me.RowEnter


Why I don't reach the sub : dg_RowEnter, as I have described in the code
above?

Why do you use Invoke? It's used for cross-thread calls.
And why call an event handler? Which event occured?

If you want to set the currenct cell, you have to set a property or
call a method of the control.
 
I want to force RowEnter event (Which exists on DataGridView).
Like forcing clicking on button.
On some languages I assume it is called fireEvent).
I don't want to set the current cell, just do RowEnter, for instance.

Thanks :)
 
Am 24.04.2010 14:02, schrieb Mr. X.:
I want to force RowEnter event (Which exists on DataGridView).
Like forcing clicking on button.
On some languages I assume it is called fireEvent).
I don't want to set the current cell, just do RowEnter, for instance.

Whenever the sun shines, your solar cells work and the generated
power switches a lever. If it's dark, you have to switch the lever
manually instead of trying to make the sun shine.
 
ROFL,

With what Armin shows that he has already answered your question in the
previous message.

Calling the Row change method

MyRowChangeMethod(nothing,nothing)

If you use the sender and the eventsarguments in your invoked method, then
you have first to set that sender and eventsargs

MyRowChangeMethod(myCreatedSender,MyCreatedEeventsArgument)
 
Armin,

In fact, very much my style, I had not expected this from you.

But a very good analogy.

Cor

..
 
Am 25.04.2010 11:20, schrieb Cor Ligthert[MVP]:
Armin,

In fact, very much my style, I had not expected this from you.

But a very good analogy.

Cor

..

:-) Well, but you're putting a torch on the solar cells to "produce" energy,
whereas I'm pressing the lever myself. So we don't agree.

In other words: Never call an event handler manually. No event occured.
Instead, start the same thing in the event handler and also in the code
where you want to start it.

And in code words: (also for Mr. Eggs)

sub MyRowChangeMethod(sender, args)

DoIt 'Here's where you want to do it

End Sub


sub YetAnotherMethod

yadayada
DoIt 'and here you wanna do it also
yadayada

end sub


sub DoIt

debug.print "about to do it..."
sleep a long time
debug.print "dunnit!"

end sub
 
Back
Top