MAPILab - Microsoft Outlook Add-ins and Software for Microsoft Exchange Server
EnglishGermanRussian

Example of work with Windows Forms

As another example of universality of MAPILab Explorer for SharePoint, let`s review the operations with class System.Windows.Forms.Form.

Open new script window and modify text of method Main the following way:
C#
 
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using MAPILab.SharePoint.Explorer.CodeForm;
using MAPILab.SharePoint.Explorer.Utilities.ScriptRunner;
using System.Windows.Forms;
 
public class Tester
{
    static void Main(
         MAPILab.SharePoint.Explorer.CodeForm.MLCodeForm thisForm
        ,MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.MLBrowser browser
        )
    {
        
        Form form = new Form(); 
        form.Text = "Hello From MAPILab Explorer For SharePoint"; 
        FlowLayoutPanel layoutPanel = new FlowLayoutPanel(); 
        form.Controls.Add(layoutPanel); 
        layoutPanel.Dock = DockStyle.Fill; 
        TextBox textBox = new TextBox(); 
        textBox.Text = "Enter you name"; 
        layoutPanel.Controls.Add(textBox); 
        Button button = new Button(); 
        button.Text = "Click Me!"; 
        layoutPanel.Controls.Add(button); 
        form.Show();
 
        // Output browser configuration 
        //browser.Text = "Browser window"; 
        //browser.DisplayMode = 
        MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.DisplayMode.Expanded; 
        browser.ReturnValue = form;
    }
}
Visual Basic
 
Visual Basic
 
Imports System
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports MAPILab.SharePoint.Explorer.CodeForm
Imports MAPILab.SharePoint.Explorer.Utilities.ScriptRunner
Imports System.Windows.Forms
 
Public Class Tester
    Shared Sub Main(ByVal thisForm 
    As MAPILab.SharePoint.Explorer.CodeForm.MLCodeForm, 
                    ByVal browser 
                    As MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.MLBrowser)
        
        Dim form 
        As Form = new Form()
        form.Text = "Hello From MAPILab Explorer For SharePoint" 
        Dim layoutPanel 
        As FlowLayoutPanel = new FlowLayoutPanel() 
        form.Controls.Add(layoutPanel)
        layoutPanel.Dock = DockStyle.Fill
        Dim textBox 
        As TextBox = new TextBox()
        textBox.Text = "Enter you name" 
        layoutPanel.Controls.Add(textBox)
        Dim button 
        As Button = new Button()
        button.Text = "Click Me!" 
        layoutPanel.Controls.Add(button)
        form.Show()
        
        ' Output browser configuration 
        'browser.Text = "Browser window" 
        'browser.DisplayMode = 
        MAPILab.SharePoint.Explorer.Utilities.ScriptRunner.DisplayMode.Expanded 
 
        browser.ReturnValue = form
    End Sub 
End Class 

The given program code creates new window, adds several controls in it, after that it is displayed using method Show() and returns reference to window object for further investigation. The result of script execution looks the following way:

Windows form
Click to open real size screenshot


Here, pay attention that properties of created window may be changed. By changing properties (without closing anything), our window can be made to look the following way:

Windows form with changed properties
Click to open real size screenshot
MAPILab Explorer for SharePoint downloaden Download free version of MAPILab Explorer for SharePoint (2760 KB):

Primary server
Secondary server

Product homepage
Screenshots
Version history
Примеры использования MAPILab Explorer for SharePoint
Example of work with MAPILab Explorer for SharePoint:
Building scripts
Operations with persisted objects
Example of work with Active Directory
Example of work with Windows Forms
Debugging of regular expressions
Exploration of W3C Document Object Model (DOM)
Leave your Suggestion:
Name:
E-mail:
 
 
Search on MAPILab.com:
Get our Newsletter:
E-mail:
© 2003-2010 MAPILab Ltd. All Rights Reserved.

Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Quick links to MAPILab software:
Reporting Solutions
Add-ins for Outlook
Plugins for Outlook
Addons for Office
Disclaimers for Exchange
Software for SharePoint
Add-ons for Exchange
Groupware tools
Developer solutions
Plugins for Microsoft Excel