Q:

C#, Send ASCII data in Microcotroller

What I'm trying to do is send 1 in ASCII value, my mk waiting for that char.
But when I press a button nothing happens. But When I send a byte to toggle a PORT, everything is works. SO I wonder how to send in ASCII, 1 value.
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)   // Here i send a byte to MK
    {
        //  serialPort1.RtsEnable = true; serialPort1.DtrEnable = true;
        //  var content = new List<byte>();
        // content.AddRange(Encoding.ASCII.GetBytes("1"));
        //  content.Add(3); // ASCII ETX
        //byte[] buffer = content.ToArray();
        // serialPort1.Write(buffer, 0, buffer.Length);    
        serialPort1.Write("1");
    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
    }

    private void button2_Click(object sender, EventArgs e)  // choosing a right com port
    {
        serialPort1.PortName = textBox1.Text;
        serialPort1.BaudRate = Convert.ToInt32(textBox2.Text);
    }

    string rs;
    byte re;

    private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e) // Da
    {
        try
        {
            //rs = serialPort1.ReadByte();
            //re = Convert.ToByte(serialPort1.ReadByte());
            rs = serialPort1.ReadExisting();
            // System.Text.Encoding.ASCII.GetString(new[] { re });
            this.Invoke(new EventHandler(type));
        }
        catch (System.TimeoutException) { }
    }

    void type(object s,EventArgs e)              // receive data
    {
        textBox4.Text += rs;
    }

    private void button3_Click(object sender, EventArgs e)   // OPen port
    {
        serialPort1.Open();
    }

    private void button4_Click(object sender, EventArgs e)  // Close port
    {
        serialPort1.Close();
    }
}

A:

You can write a string to the serial port in that way: the string must contain only ASCII characters in the range 0x00 to 0x7F since the ASCII encoding is used by default (you can change the encoding by setting the SerialPort.Encoding property).
As others have said in the comments, you need to append the ETX character to match the commented-out code, which you can do as follows:
serialPort1.Write("1\x03");

Or, more generally, if you want to build a string containing control characters, you can do something like:
const char STX = '\x02';
const char ETX = '\x03';
... etc, other control characters you want to use

...

var s = String.Format("1{0}", ETX);
serialPort1.Write(s);

