Identifying a form control that call a function

M

Martin Stender

Hi all -

I can't seem to figure out how to - within a function - identify which form
control called the function.

I need to return focus to the control after the function has done its work
....

Any ideas?

Best regards
Martin
 
M

MarkInSalemOR

I don't know of a VB function or method that does this. What I do in these
cases is either send a string that identifies it and then use that string to
set the focus. Or I pass the control object into the function and then
setfocus to the object. It's also handy if you are setting the value of the
control or changing it's properties.

For example
Private Sub TextBox_Exit
Demo(TextBox.Value,TextBox)
End Sub

Public Function Demo(strArgument as string, ctlCaller as Control)
'function code here
ctlCaller.BackColor = vbRed
ctlCaller.Value = "function result"
ctlCaller.SetFocus
End Function


~Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top