Connection fails with 3270 IBM

Nov 9, 2011 at 8:04 AM

I am trying to convert this code to .NET

In VB6 is working

 strTopic = "IBM3270|Session" & Form1.NroSes
    With txtBox
   
        .LinkTimeout = 100
        .LinkTopic = strTopic
        .LinkMode = vbLinkManual
        .LinkItem = "STRING(331,39,""Erabiltzailea..... / Usuario ........ :"")"
        .LinkRequest
           
        booLoaded = True
       
        If Left(txtBox.Text, 4) <> "None" Then
            CursorTermIni = 92
            CursorTermLong = 4
            .LinkItem = "EPS(" & CursorTermIni & "," & CursorTermLong & ",1)"
            .LinkRequest
            strTerminal = Mid(txtBox.Text, 21, 4)
            strTerminalCICS = strTerminal
           
            .Text = "R5C52"
            .LinkItem = "SETCURSOR"
            .LinkPoke
           
            Linea = "[SENDKEY(" & Comillas & Usuario & Comillas & ")]"
            .LinkExecute Linea

            .Text = "R7C52"
            .LinkItem = "SETCURSOR"
            .LinkPoke

            Linea = "[SENDKEY(" & Comillas & Clave & Comillas & ")]"
            .LinkExecute Linea

            .LinkExecute "[SENDKEY(enter)]"

 

In .NET I try with this:

ddeClient_TextBox1 = new NDde.Client.DdeClient("IBM3270", "SessionA", textBox1);
                //Connect to the DDE Server
                ddeClient_TextBox1.Connect();
                ddeClient_TextBox1.Poke("R5C52", "probando", 4000);

 

 

Result:

NDde.DdeException: The client failed to poke "IBM3270|SessionA!R5C52". ---> NDde.Foundation.DdemlException: The client failed to poke "IBM3270|SessionA!R5C52".
   en System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   en System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   en NDde.Advanced.DdeContext.Invoke(Delegate method, Object[] args)
   en NDde.Advanced.DdeContext.Invoke(ThreadStart method)
   en NDde.Client.DdeClient.Poke(String item, Byte[] data, Int32 format, Int32 timeout)
   --- Fin del seguimiento de la pila de la excepción interna ---
   en NDde.Client.DdeClient.Poke(String item, Byte[] data, Int32 format, Int32 timeout)
   en NDde.Client.DdeClient.Poke(String item, String data, Int32 timeout)
   en ClaveUnicaCS2.Form1.button3_Click(Object sender, EventArgs e) en C:\inetpub\wwwroot\ClaveUnicaCS2\Form1.cs:línea 122

I have no idea what to do it.

Can anyone help me? please