.net equivalent

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

what's the equivalent to sendmessage?

i want to explicitly kill the focus of a control.

tia,

steve
 
I don't think there is one but you could try this:

If TextBox1.Focus = True Then
SendKeys.Send(vbTab)
ElseIf Button1.Focus = True Then
SendKeys.Send(vbTab)
End If

As long as the control doesn't accept as Tab you'll be OK
 
steve said:
what's the equivalent to sendmessage?

i want to explicitly kill the focus of a control.

Call the 'Focus' method of an other control.
 
i have a section of a form where all of it's controls are dynamically
generated...the parent form is - and needs to be - detached from some of the
activities of the class that generates/manages these controls. if there is
only one managed control, then the class has no "known" control to set the
focus on. if i have control.validating event code to be run in a managed
control and the parent form has code behind an object's click event...and
that object *can't* receive focus (like a picturebox used in liue of a
button) then that code will run w/o executing the managed control's
validating code. this is bad since the object's click event could call the
managed class' save method.

if i can just tell the control to loose focus then the validation code will
execute...all i will have to create is a method to have the managing class
Update...or something like that. otherwise, i'll have to get more intimate
than i'd like w/ the parent form.
 
Steve,
That is what we all have once in a while, we invent the most beautiful
methods, but after a while we see that to keep it complete it becomes
everytime more complex.
And the worse is, we have to do it all ourself then.
But you will be very proud on yourself when you have fixed it than.
:-)
Cor
 
Back
Top