Skip to main content

I am putting together a simple app that sends keystrokes to an ObjectX AS400 display control. I have figured out how to send the keys but I cannot figure out how to change the system the control connects to when I run the connect method. When I right click the object and select activeX properties it look like I can change the default connection to my saved 5250 connections, but every time I connect it defaults to the demo host. Is there a way to set the default connection in code(C#)?


#Rumba

I am putting together a simple app that sends keystrokes to an ObjectX AS400 display control. I have figured out how to send the keys but I cannot figure out how to change the system the control connects to when I run the connect method. When I right click the object and select activeX properties it look like I can change the default connection to my saved 5250 connections, but every time I connect it defaults to the demo host. Is there a way to set the default connection in code(C#)?


#Rumba

Hi elcron,
for the TN5250 Interface of the ObjectX AS400 display control you can try:

ObjectXAS400Display1.Hostinterface.Name = "WallData.TN5250"

' Set variable to Interface
TN5250 = ObjectXAS400Display1.HostInterface.Interface
TN5250.InsertSystem = "yourAS400.com"
TN5250.SelectedSystemName = "yourAS400.com"
TN5250.TcpPort = 992

' If no secure connection is needed just set below Parameter to False
TN5250.SSLAuthentication = True
TN5250.SSLEnabled = True

TN5250.SSLTrustAllIssuersInCert = True
TN5250.SSLMatchHostNameInCert = False
TN5250.UserInteractive = True
TN5250.Secure.SSLValidDatesInCert = False
TN5250.StartTLSEnabled = False


I am putting together a simple app that sends keystrokes to an ObjectX AS400 display control. I have figured out how to send the keys but I cannot figure out how to change the system the control connects to when I run the connect method. When I right click the object and select activeX properties it look like I can change the default connection to my saved 5250 connections, but every time I connect it defaults to the demo host. Is there a way to set the default connection in code(C#)?


#Rumba
Thanks for the reply, What type is the TN5250 variable? When I try to build I get an error that TN5250 is not declared.

I am putting together a simple app that sends keystrokes to an ObjectX AS400 display control. I have figured out how to send the keys but I cannot figure out how to change the system the control connects to when I run the connect method. When I right click the object and select activeX properties it look like I can change the default connection to my saved 5250 connections, but every time I connect it defaults to the demo host. Is there a way to set the default connection in code(C#)?


#Rumba

The variable is declared As Object.

Below snippet works (VB.net)

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim lRetValue As Long
        Dim TN5250 As Object    ' Declare object variable

        AxObjectXAS400Display1.HostInterface.Name = “WallData.TN5250”
        AxObjectXAS400Display1.HostInterface.Interface.SelectedSystemName = "yourHost.com"

        TN5250 = AxObjectXAS400Display1.HostInterface.Interface
        TN5250.TcpPort = 992
        TN5250.SslAuthentication = True
        TN5250.SslEnabled = True

        lRetValue = AxObjectXAS400Display1.Connect

    End Sub


I am putting together a simple app that sends keystrokes to an ObjectX AS400 display control. I have figured out how to send the keys but I cannot figure out how to change the system the control connects to when I run the connect method. When I right click the object and select activeX properties it look like I can change the default connection to my saved 5250 connections, but every time I connect it defaults to the demo host. Is there a way to set the default connection in code(C#)?


#Rumba
Thanks! That worked. I really appreciate it.