Re: Just what the h can we do with "sender" - new guy question

Tech-Archive recommends: Fix windows errors by optimizing your registry




Hi,
In the context you describe the sender is not much use to you.

The problem is that the sender is the context menu.
The data that you want to deal with is in the treeview.

There may be a more elegant way but what I do here is capture
where you are in the treeview with the mousedown event into a global
point say mPosition.
The context menu decides what action to take
And in that code you reference the treeview by using
currentnode=myTreeView.mygetnodeat(mPosition)
hth
Bob


On Fri, 02 Nov 2007 01:50:28 -0000, "T.Davis"
<trevorhughdavis@xxxxxxxxx> wrote:

Okay, when you subscribe to an event, and that event fires, it is
passed (sender, eventargs), yea?

So what is sender? Can you do anything with it other than toString()?

If it's a reference to the object that fired the event, how can I
access that object's properties?


I'm new, and am trying to get my sea legs. I've got an application
that fills a treeview with tables from a mysql database.

I've added a context menu. I want one of the items to be "load this
table." In order for that to work, I need to get the text of the
treeview node. How do I do this?

treeview

+ blah table <-- context menu from this part, select "Load this
table" Need to get "blah"
- id
- name
- isugly

+ blah_again table
- id
- name
- description


Thanks in advance.

ps.

i find the word "newbie" icky.
.



Relevant Pages

  • Re: Rational for not making cursor tagged in Containers
    ... With the traditionally abstract OO, operations are executed as a result ... i.e. ones marshaled and ones referenced (recipients). ... This adds additional asymmetry, c, the sender is invisible and actually is ... the sender's context, which is even not a value. ...
    (comp.lang.ada)
  • Treeview context menus dont seem to work right.
    ... >I'm using vb.net and the treeview control. ... created a context menu with a few items on it and set the ... If the selectedNode property is not ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: TreeView In GridView - OnTreeNodeCheckChanged event problem
    ... OnClick event. ... Dynamic Populating the TreeView in Databound.... ... protected void GridView1_OnRowDataBound(object sender, GridViewRowEventArgs ... Protected Sub Page_Load(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: TreeView In GridView - OnTreeNodeCheckChanged event problem
    ... OnClick event. ... Dynamic Populating the TreeView in Databound.... ... protected void GridView1_OnRowCreated(object sender, GridViewRowEventArgs ... Protected Sub tv_TreeNodeCheckChanged(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: treeview selected node
    ... Private Sub scrTree_AfterSelect(ByVal sender As Object, ... When I comment out the messagebox line, the form with the treeview ... pick up the treeview object from 'sender' or is there a better or more ...
    (microsoft.public.dotnet.languages.vb)