How to display Form from the Comman Button

Add-in Express™ Support Service
That's what is more important than anything else

How to display Form from the Comman Button
 
subhash ravada




Posts: 6
Joined: 2007-01-23
Hi,

I have a ADXOIForm1 which is attached to a test folder.

When I click the "test" folder ADXOIForm1 is displayed in the outlook.

I want to do the same functionaly from the Command BAR.

i added one commandbutton to adxOlExplorerCommandBar1.

I want to show the form in the click event of the command button.

could you please let me know it is possible or not.

If it is possible let me know how to do it.

Thanks,
Subhash
Posted 23 Jan, 2007 13:25:19 Top
Fedor Shihantsov


Guest


Hi Subhash,

In the latest version 3.# you can show a form in the click event of the command button.
But at first you should be prevent form displaying.
Below the code of ADXOlForm and AddinModule that demonstrates one way to do this.

public class AddinModule : AddinExpress.MSO.ADXAddinModule
{
    ... 
    //The Click event
    private void adxCommandBarButton1_Click(object sender)
    {
        if (LatestForm != null)
        {
            //Call the custom method
            LatestForm.SpecialShowMethod();
            //Also you can use the ADXOlFormsCollectionItem.FormInstances 
            //method to access to forms
        }
    }

    //A latest form that we prevented 
    private ADXOlForm1 _latestForm = null;
    public ADXOlForm1 LatestForm
    {
        get
        {
            return _latestForm;
        }
        set
        {
            _latestForm = value;
        }
    }
}

public class ADXOlForm1 : AddinExpress.OL.ADXOlForm
{
    ...

    //Use the ADXOlForm.ADXBeforeFormShow event 
    //and ADXOlForm.Visible property to prevent a form displaying.
    private void ADXOlForm1_ADXBeforeFormShow()
    {
        if (!SpecialShowMethodRunning)
        {
            //Prevent the form showing
            Visible = false;
            //Remember the latest form in the AddinModule
            (AddinModule as ShowFormFromCommandBar.AddinModule).LatestForm = this;
        }
    }

    private bool SpecialShowMethodRunning = false;
    //The custom method for use from AddinModule
    public void SpecialShowMethod()
    {
        try
        {
            SpecialShowMethodRunning = true;
            this.Show();
        }
        finally
        {
            SpecialShowMethodRunning = false;
        }

    }
}


P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 24 Jan, 2007 04:51:05 Top
subhash ravada




Posts: 6
Joined: 2007-01-23
Can you please send me the sample project. With the Sample I am getting the null pointer exception at

this.Show();

Thanks,
Posted 09 Feb, 2007 22:00:17 Top
Fedor Shihantsov


Guest


Posted 12 Feb, 2007 05:12:49 Top
subhash ravada




Posts: 6
Joined: 2007-01-23
Hi

When I run this Sample the form is not displayed when I click on the button.

The Latest Form is always null, so it is not displaying any form when click on this button.

private void adxCommandBarButton1_Click(object sender)
{
if (LatestForm != null)
{
//Call the custom method
LatestForm.SpecialShowMethod();
//Also you can use the ADXOlFormsCollectionItem.FormInstances
//method to access to forms
}
}

So please help me to show the form in the click event.

Thanks,
Subhash
Posted 13 Feb, 2007 21:34:44 Top
Fedor Shihantsov


Guest


Hi,

This sample works for the "Personal Folders\Inbox" folder only.
Set the ExplorerItemTypes property to Mail and try once again.
Please, let me know about the result.

What outlook version do you use?
Posted 14 Feb, 2007 03:45:18 Top
subhash ravada




Posts: 6
Joined: 2007-01-23
Hi,

I set the ExplorerTypes property to mail. After that also The form is not displayed when click on the button.

I am using outlook 2007. and Visual studio 2005.

Thanks,
Subhash
Posted 14 Feb, 2007 22:59:15 Top
Fedor Shihantsov


Guest


Hi,

I have just tested in Outlook 2007/VS2005. It works perfectly.

Does the ADXOlForm1_ADXBeforeFormShow event fire?
What version of Add-in Express do you use (see the About dialog in the AddinModule)?
Posted 15 Feb, 2007 03:26:57 Top
subhash ravada




Posts: 6
Joined: 2007-01-23
Hi,

ADX Extensions .NET for Microsoft Outlook 3.1.0903 Premium
Toolbar Controls .NET for Microsoft Office 3.1.455

ADXOlForm1_ADXBeforeFormShow event is is not fired.

Can you let me know what are the steps you did in the outlook to get this form.

Thanks,
Subhash
Posted 15 Feb, 2007 10:24:05 Top
Fedor Shihantsov


Guest


I built and registered the add-in, opened Outlook, clicked the "Show latest form" button.

Please upgrade the product up to v3.3 version and let me know about the result.

Could you please test another project http://www.add-in-express.com/projects/adx-x-ol-3-explorerforms.zip
Does a form display in Explorer?
Posted 16 Feb, 2007 14:16:31 Top