visual studio button sending serial data

Status
Not open for further replies.

fawadbutt

Member level 3
Joined
Oct 29, 2010
Messages
61
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Location
Lahore, Pakistan, Pakistan
Visit site
Activity points
1,754
hi.. i create a application in visual studio 2010 using C#..
i m sending the character form Serial port when pressing the button ,when i press one time one ASCII character send via Serial Port.
the problem is ,,i want to make this type of button .when i press one time start sending character until i unpress the button.plz help me.
here is may code:


Code:
      private void button5_Click(object sender, EventArgs e)
        {
            if (!serialPort1.IsOpen)
            { MessageBox.Show("First Open the Port"); return; }
            else
            {
                serialPort1.Write("1");
            }
        }
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…