1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating a loop around a checkedbox

Discussion in 'C#' started by firstoption, Sep 4, 2014.

  1. firstoption

    firstoption New Member

    Joined:
    Apr 1, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    Good day to all,
    Please i need your support on how to modify the program below so that it can read the data(temperature value) sent from the microcontroller as long as the Checkbox is checked.At the moment the function
    Code:
    myFtdiDevice.Read(readData, numBytesToRead, ref numBytesRead);
           
    reads only the first temperature value sent from the microcontroller,the subsequent temperatue values are not being updated even though the Checkbox is still checked.I would be very glad if somebody could put me through on how to create a Loop as Long as the Checkbox is checked.Thank you for the usual Support.Best regards.




    Code:
    
    
     private void checkBox1_CheckedChanged(object sender, EventArgs e)
            {
                UInt32 numBytesRead = 0;
                UInt32 numBytesToRead = 1;
                byte[] readData = new byte[10];
    
               ftStatus = myFtdiDevice.Read(readData, numBytesToRead, ref numBytesRead);
            
               label11.Text = Convert.ToString(readData[0]);
         
            } 
    
    
    
     
  2. alia123

    alia123 New Member

    Joined:
    Jan 8, 2016
    Messages:
    65
    Likes Received:
    3
    Trophy Points:
    0
    Hey, try using this code :
    Code:
    var sList = "";
    $('input[type=checkbox]').each(function () {
        var sThisVal = (this.checked ? "1" : "0");
        sList += (sList=="" ? sThisVal : "," + sThisVal);
    });
    console.log (sList);
     

Share This Page