By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,343 Members | 925 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,343 IT Pros & Developers. It's quick & easy.

How can i find type sender object?

P: n/a
Hi,
i call
Call treeviewXi_DoubleClick("Try", e)

from another procedur..

and in treeviewX_DoubleClick i use this string and do what i want

example : if sender="try" then doit

but in this case, when user do doubleclick, in treeview doubleclick event,
sender object is turn treeview object and give error due to "if sender="try"
then doit" row

i wantto this:

Private Sub treeviewwX_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles trwErisimAgaci.DoubleClick

dim x as string

if istypefunction(sender)=string then

x=sender

else

x=treeviewX.SelectedNode.Tag

endif

How?

Thanks in advance,


Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ok i found ..
sender.gettype.name
:)
Nov 20 '05 #2

P: n/a
nomenklatura,
if istypefunction(sender)=string then
I would use the "TypeOf ... Is" operator to find the type of sender.

If TypeOf sender Is String Then
However! This seems like very bad & fragile code!

Remember that Sender is the control that raised the event, NOT a string!!!

I would create a new routine that accepted a string, the
treeviewXi_DoubleClick event handler would call this new routine with
treeviewX.SelectedNode.Tag, while every place else would call the routine
with the specific string value.

Hope this helps
Jay

"nomenklatura" <il******@operamail.com> wrote in message
news:Oe**************@TK2MSFTNGP12.phx.gbl... Hi,
i call
Call treeviewXi_DoubleClick("Try", e)

from another procedur..

and in treeviewX_DoubleClick i use this string and do what i want

example : if sender="try" then doit

but in this case, when user do doubleclick, in treeview doubleclick event,
sender object is turn treeview object and give error due to "if sender="try" then doit" row

i wantto this:

Private Sub treeviewwX_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles trwErisimAgaci.DoubleClick

dim x as string

if istypefunction(sender)=string then

x=sender

else

x=treeviewX.SelectedNode.Tag

endif

How?

Thanks in advance,

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.