calling user control method from another form in C#

  • Thread starter calling user control method from another
  • Start date
C

calling user control method from another

Hi all, I have developed an addin for outlook using C# (VS 2005). My Add-in
adds sum buttons to outlook as well as a panel at the side of outlook. The
panel displays sum discussions of our forum and also displays the profile of
selected user.

Here the panel is a user control which contains sum general controles lky
labels n text boxes.... n have sum methods which extracts the required values
n fills in the labels n textboxes.

i m using 1 more form for login. nw the problm is when the user opens the
outlook the login form will b displayed, n when the user enters a valid id n
password it should call refresh button (in MyPanel - UserControl) which fills
the required info n make it visible...

So here i need to access the method in MyPanel from a Login form.

As i dont hav much experience in C# i m not getting hw to do this. I tried
making the "Refresh" link as static but this Refersh link calls a non-static
method "ST_FetchMsgs()".
If i make this method as static then i need to make all the controles in the
panel as static.

When the login form is displayed i already hav Refresh link in the panel. so
after successful login i just need to click this Reresh link. This can be
done if i can get the reference to the existing "MyPanel".

To refer to the existing form v do the following:

frmNewMsg objfrmNewMessaage = (frmNewMsg) ActiveForm;

Then we can access the public controles/methods of that form. Similarly is
der any way to get the reference of the existing user control? (as it is
already loaded in outlook)


Thanks in advance,

Mahesh S
 
K

Ken Slovak - [MVP - Outlook]

You don't say whether you are using a shared managed code addin or a VSTO
addin, the methods of exposing calls in your addin to outside code differ
depending on that.

What you do in either case is to expose a public method or methods you can
call from outside your addin. Those methods in turn call code internal to
your addin.

You can see how it's done in either case from some addin templates I have
for Outlook 2007 on my Web site. Just download the template that's
appropriate for you for VATO or a shared addin. The templates are located at
http://www.slovaktech.com/outlook_2007_templates.htm




"calling user control method from another" <calling user control method from
(e-mail address removed)> wrote in message
news:[email protected]...
 

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