Search the web
Sign In
New User? Sign Up
vsnetaddin · Visual Studio.NET Add-ins
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Handling Events from ToolWindows in the Connect.cs Class   Message List  
Reply | Forward Message #3853 of 3878 |
Re: Handling Events from ToolWindows in the Connect.cs Class

Phil,

I understand that event-handling should be done in the Form which it
was created. However is it possible for the Exec method in the
Connect.cs class to listen for commands (i.e. button_Click) on a
User Control? Should the example code below work?

public void Exec(string commandName...
{
...
if(commandName == "MyAddin.MyUserControl.btnMyButton_Click)
{
/* Code to close MyUserControl goes here*/
/* Code to open AnotherUserControl goes here*/
}
...
..

Thanks

--- In vsnetaddin@yahoogroups.com, "Phil Jollans" <phil@...> wrote:
>
> Hi Ngo,
>
> this isn't so much an Add-In problem, as a general .NET
programming question.
>
> If the button is on a UserControl, then the handler for the button
click event should go in that UserControl. Just double click on it
in the designer window and it will add the handler function.
>
> Phil
>
> ----- Original Message -----
> From: ngo_udhs
> To: vsnetaddin@yahoogroups.com
> Sent: Monday, January 14, 2008 7:28 PM
> Subject: [vsnetaddin] Handling Events from ToolWindows in the
Connect.cs Class
>
>
> I've created a add-in in VS.NET 2005 using C#.
>
> The add-in loads a tool window OnConnection and it contains a
User
> Control with input text fields and a "Login" button.
>
> After the user clicks on this button, I want the User Control to
> close and open another User Control after.
>
> I was thinking I can have the Exec function in Connect.cs to
listen
> for events such as a button_click however I had no such luck.
Would
> this be the correct approach?
>
> I've googled all over, but had no luck finding any advance
articles
> on handling ToolWindow events.
>
> Any help is greatly appreciated.
>
> Thanks
>
> (The code below will explain a little more of what I'm trying to
do.)
>
> public void Exec(string commandName, vsCommandExecOption... )
> {
> handled=false;
> if(executeOption ==
> vsCommandExecOption.vsCommandExecOptionDoDefault)
> {
> if(commandName == "MyAddin.Connect.MyAddin")
> {
> handled = true;
> return;
> }
> /* Clicking the "Login" button on the User Control form does
> not execute this command. Why?*/
>
> if(commandName == "MyAddin.LoginUserControl.btnLogin_Click)
> {
> /* Code to close LoginUserControl goes here*/
> Debug.Print("=========Login button clicked!!=========");
> /* Code to open another User Control goes here*/
> ....
> }
> }
> ...
> ..
> /* End of code snippet */
>
>
>
>
>
> [Non-text portions of this message have been removed]
>





Tue Jan 15, 2008 2:54 pm

ngo_udhs
Offline Offline
Send Email Send Email

Forward
Message #3853 of 3878 |
Expand Messages Author Sort by Date

I've created a add-in in VS.NET 2005 using C#. The add-in loads a tool window OnConnection and it contains a User Control with input text fields and a "Login"...
ngo_udhs
Offline Send Email
Jan 14, 2008
7:12 pm

Hi Ngo, this isn't so much an Add-In problem, as a general .NET programming question. If the button is on a UserControl, then the handler for the button click...
Phil Jollans
pjollans
Offline Send Email
Jan 14, 2008
9:56 pm

Phil, I understand that event-handling should be done in the Form which it was created. However is it possible for the Exec method in the Connect.cs class to...
ngo_udhs
Offline Send Email
Jan 15, 2008
2:54 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help