Main Programming Tasks

Top  Previous  Next

For using the Terminal Emulator components the main tasks are:

 

Drop a Tn3270 or Tn5250 Component on your form.
Drop to your form the following components: Display, StatusBar and Keyboard.
Set the Telnet property for Emulator and StatusBar components to the telnet component (Tn3270 or Tn5250). You can set it at run-time using the following code in the Load or Create event of the form:

 

 VB.NET:

 Private Sub Form_Load(sender As System.Object, eventArgs As System.EventArgs)

   tnDisplay.Telnet = tn3270

   tnStatusBar.Telnet = tn3270

   ...

 End Sub

 

 C#:

 private void Form_Load(object sender, System.EventArgs e)

 {

   tnDisplay.Telnet = tn3270;

   tnStatusBar.Telnet = tn3270;

   ...

 }

 

Set the Emulatorcomponent property from StatusBar component to the Display dropped in the form.

 

 VB.NET:

          tnStatusBar.Display = tnDisplay

 

 C#:

          tnStatusBar.Display = tnDisplay;

 

Set Keyboardcomponent property from Emulator component to the Keyboard dropped in the form.

 

 VB.NET:

   tnDisplay.Keyboard = tnKeyboard

 

 C#:

   tnDisplay.Keyboard = tnKeyboard;

 

Now, all what you have to do is fill in the Host property for the Telnet component chosen, with your Mainframe DNS name or TCP/IP address and execute the Connect method. For example:

 

 VB.NET:

 Private Sub Button1_Click(sender As System.Object, eventArgs As System.EventArgs)

   'In the edit box you have to type the DNS name or

   'TCP/IP address of the mainframe you want to connect to.

   tn3270.Host = Edit1.Text

   tn3270.Connect()

   ...

 End Sub

 

 C#:

 private void Button1_Click(object sender, System.EventArgs e)

       {

   // In the edit box you have to type the DNS name or

   // TCP/IP address of the mainframe you want to connect to.

   tn3270.Host = Edit1.Text;

   tn3270.Connect();

   ...

 }

 

Now you have a complete terminal emulator.