vendredi 5 janvier 2018

To assign value to a variable based on the click checkbox vb.net

I am trying to assign a value to a variable(b1) when the checkbox is clicked. The value I am trying to assign is another variable(bot_lcd) which runs in a thread. So when the checkbox is checked I want the variable(bot_lcd) to be assigned to be b1. The value of bot_lcd will keep on changing but I want b1 to have that value of bot_lcd when the checkbox was clicked. this is the code I have :

Private Sub CheckBox1_Click(sender As Object, e As EventArgs) Handles CheckBox1.Click

bot_lcd = b1


    End Sub

and then in the thread I am doing

 If CheckBox1.Checked = True Then
                com_bot.Write(b1)
                TextBox5.Invoke(Sub()
                                    TextBox5.Text = (b1)
                                End Sub)

            Else
                com_bot.Write(bot_lcd)
                TextBox5.Invoke(Sub()
                                    TextBox5.Text = (bot_lcd)
                                End Sub)

Thanks!




Aucun commentaire:

Enregistrer un commentaire