need help with form2.checkbox.checkstate

11/04/2013 18:44 sander2828#1
Code:
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork

while 1

if form2.checkbox.checkstate= 1 then
                MsgBox(Form2.Checkbox.Checkstate)
            End If

        End While
    End Sub
i don't know why but if form2.checkbox is checked or not it returns 0
and with form2.checkbox.checked it returns false even if it should be true
11/04/2013 18:53 Mansuro#2
Try this

Code:
        If form2.checkbox.checked = True Then
            MsgBox("True")
        ElseIf form2.checkbox.checked = False Then
            MsgBox("False")
        End If
11/04/2013 19:04 sander2828#3
Quote:
Originally Posted by SmokinDeath View Post
Try this

Code:
        If form2.checkbox.checked = True Then
            MsgBox("True")
        ElseIf form2.checkbox.checked = False Then
            MsgBox("False")
        End If
i did and i did again but still it gives me false even when checkbox is checked.
i am using background worker on form1 but checkboxes are in form2

when i use the your code before my program uses background worker it returns me true but when i use your code in background worker it returns false
11/04/2013 19:09 Mansuro#4
Try to use a Button with the same code.

In my program it works perfectly.
11/04/2013 19:14 sander2828#5
Quote:
Originally Posted by SmokinDeath View Post
Try to use a Button with the same code.

In my program it works perfectly.
i played around with the code a little and tested if i depends on that checkbox being in different form than background worker matters in matter of fact it does since when i made checkbox into form1(same form with backgroundworker) it worked so any idea how to make it work with form 2 ?

and i added you to skype my skype name is margus.nightcore
11/04/2013 19:18 jibi1996#6
I guess that your problem is on the while statement. If you want to realize action when your bworker is working use:
Code:
BackgroundWorker.IsBuy
you mighty also add
Code:
Application.DoEvents()
otherwhise the program will freeze.
11/04/2013 20:55 'Heaven.#7
^Please kill yourself.


NEVER USE DOEVENTS
11/04/2013 21:46 schneider1424#8
you cant because checkbox is a class not a control name -.- it has to be something like this
Code:
if form2.checkbox1.checked = true then 'you cant use checkbox as a control name'
   msgbox("true")
else
   msgbox("false")
end if
'if you want to declare outside of form designer then do this'
dim testcheckbox as new checkbox
:facepalm:
11/04/2013 22:43 sander2828#9
i solved problem with little help from smoking death and by my self