none
conversion of 64Bit application to 32 bits c# RRS feed

  • General discussion

  • hello

    I carried a small application that allows me to retrieve data via a serial port.
    a data type of example that I get:   123456789458123698547852001025...

    I did it on a PC Windows 8 to 64 bits, it works well. I recover the data correctly.

    I realized the application executable.(relese,x86). for, run it on a PC (Windows XP - 32bit).

    but. when I execute on a PC (32 bit). I receive data. in extended code:

    the code that I made:

    public string value = string.Empty; 
    
    private void serialPort2_DataReceived(object sender, SerialDataReceivedEventArgs e)
            {
      while (serialPort2.BytesToRead > 0)
                {
        char[] buffer = new char[255]; // on crée un char de 255 caractere
    
      int longueur_bytes_read = serialPort2.Read(buffer, 0, buffer.Length); 
    
       for (int i = 0; i < longueur_bytes_read; i++)
                     {                                  
                         value +=buffer[i];
                         byte[] bytes = Encoding.Default.GetBytes(value);
                         value = Encoding.ASCII.GetString(bytes);                                           
                    }
    
                     StatusLabel1.Text = "Transfert en cours...";    
                    }
    
            /*    int bytes = serialPort2.BytesToRead;
                while (bytes > 0)
                {
                    byte[] buffer = new byte[bytes];
                    serialPort2.Read(buffer, 0, bytes);
                    List<byte> myBytesList = buffer.ToList();
                    value = System.Text.Encoding.UTF8.GetString(myBytesList.ToArray());*/
                    
                }
        }
    
      
    
            private void button1_ecrir_Click(object sender, EventArgs e)
            {
                //textBox1.SelectedText = string.Empty;
                textBox1.AppendText(value + "\r\n");
               
                
            }


    the, I do not understand why.

    can you halp me.



    • Edited by tintine Wednesday, June 10, 2015 1:55 PM
    • Moved by Sheng Jiang 蒋晟 Thursday, June 11, 2015 11:53 PM Not winforms related
    Wednesday, June 10, 2015 12:42 PM

All replies