Sending numbers from c# to arduino

Hey guys, I'm a tad confused. I was wondering if any c# experts would help me out on this nooby question. I want to (firstly) send a single number to my arduino board, from my c# form. (Later i would like to send a whole array of numbers to my board).

I began writing this code but I'm just stuck on how to send the variable from my numeric up down box, (Number1.Value). It always returns errors about the variables being in the wrong type, which unfortunately I do not understand.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


namespace SimpleSerial
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            Stop.Enabled = false;
            Send.Enabled = false;
            number1.ReadOnly = true;
        }

        private void Start_Click(object sender, EventArgs e)
        {
            serialPort1.PortName = "COM1";
            serialPort1.BaudRate = 9600;

            serialPort1.Open();
            if (serialPort1.IsOpen)
            {
                Start.Enabled = false;
                Stop.Enabled = true;
                Send.Enabled = true;
                number1.ReadOnly = false;
            }

        }

        private void Stop_Click(object sender, EventArgs e)
        {
            if (serialPort1.IsOpen)
            {
                serialPort1.Close();
                Start.Enabled = true;
                Stop.Enabled = false;
                Send.Enabled = false;
                number1.ReadOnly = true;
            }

        }

        private void Send_Click(object sender, EventArgs e)
        {
// on click, send an array of numbers to arduino
        }


        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (serialPort1.IsOpen) serialPort1.Close();
        }

    }
}

Any help, advice or anything appreciated Thanks

Any help, advice or anything appreciated

First suggestion would be to show what you've tried, in the Send_Click() method.

Second suggestion is to use Number1.Value.ToString() to convert the number to a string, and send that string. Reassemble the string on the Arduino, and use atoi to convert the string back to a number.

Thanks PaulS, but is there no way of sending the data as a single byte? So as to avoid conversions?

Sending as a string was my second suggestion. What range of numbers are you planning to send? Sending as a single byte implies that the range of numbers is pretty small (0 to 255). There is hardly a conversion issue with integers in that range.