InfoConnect API Guide
Attachmate.Reflection.UserControl.Wpf.IbmHosts Namespace / IbmTerminalControl Class / InitInstance Method / InitInstance(HostType) Method
Host type for the new session
Example


In This Topic
    InitInstance(HostType) Method
    In This Topic
    Initializes this terminal instance with a given HostType.
    Syntax
    'Declaration
     
    
    Public Overloads Sub InitInstance( _
       ByVal hostType As HostType _
    ) 
    'Usage
     
    
    Dim instance As IbmTerminalControl
    Dim hostType As HostType
     
    instance.InitInstance(hostType)
    public void InitInstance( 
       HostType hostType
    )

    Parameters

    hostType
    Host type for the new session
    Remarks

    The InitInstance call is required to initialize the terminal user control with sufficient information to render a terminal user interface.

    Use the TerminalInitializedEventHandler to check for any errors that may have occurred during terminal initialization

    Example
    Initialize a terminal user control and check for errors before setting the host address and connecting
    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        ibmTerminalControl1.InitInstance(Attachmate.Reflection.UserControl.Wpf.IbmHosts.HostType.IBM3270);
    }
     
    private void IbmTerminalControl1_TerminalInitializedEvent(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
    {
        // Check if error occurred during the terminal initialization
        if (e.Error != null)
        {
            MessageBox.Show("Error during terminal initialization step: " + e.Error); return;
        }
     
        ibmTerminalControl1.IbmTerminal.HostAddress = "yourHostName";
        ibmTerminalControl1.IbmTerminal.Port = 23;
        ibmTerminalControl1.IbmTerminal.Connect();
    }
    See Also