Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 15:30

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



need help with form2.checkbox.checkstate

Discussion on need help with form2.checkbox.checkstate within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2011
Posts: 278
Received Thanks: 67
need help with form2.checkbox.checkstate

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
sander2828 is offline  
Old 11/04/2013, 18:53   #2
 
Mansuro's Avatar
 
elite*gold: 462
The Black Market: 110/0/0
Join Date: Mar 2013
Posts: 3,427
Received Thanks: 333
Try this

Code:
        If form2.checkbox.checked = True Then
            MsgBox("True")
        ElseIf form2.checkbox.checked = False Then
            MsgBox("False")
        End If
Mansuro is offline  
Old 11/04/2013, 19:04   #3
 
elite*gold: 0
Join Date: Feb 2011
Posts: 278
Received Thanks: 67
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
sander2828 is offline  
Old 11/04/2013, 19:09   #4
 
Mansuro's Avatar
 
elite*gold: 462
The Black Market: 110/0/0
Join Date: Mar 2013
Posts: 3,427
Received Thanks: 333
Try to use a Button with the same code.

In my program it works perfectly.
Mansuro is offline  
Old 11/04/2013, 19:14   #5
 
elite*gold: 0
Join Date: Feb 2011
Posts: 278
Received Thanks: 67
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
sander2828 is offline  
Old 11/04/2013, 19:18   #6
 
elite*gold: 0
Join Date: Mar 2011
Posts: 306
Received Thanks: 156
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.
jibi1996 is offline  
Old 11/04/2013, 20:55   #7
 
'Heaven.'s Avatar
 
elite*gold: 1
The Black Market: 331/0/0
Join Date: Jun 2012
Posts: 5,819
Received Thanks: 3,200
^Please kill yourself.


NEVER USE DOEVENTS
'Heaven. is offline  
Old 11/04/2013, 21:46   #8
 
schneider1424's Avatar
 
elite*gold: 0
Join Date: Jun 2012
Posts: 48
Received Thanks: 32
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
schneider1424 is offline  
Old 11/04/2013, 22:43   #9
 
elite*gold: 0
Join Date: Feb 2011
Posts: 278
Received Thanks: 67
i solved problem with little help from smoking death and by my self
sander2828 is offline  
Reply


Similar Threads Similar Threads
C# etwas aus Form2 in Form1 bringen
01/06/2013 - .NET Languages - 12 Replies
hallo ^^ Wie die überschrift schon sagt... Ich möchte bsp etwas machen das vom Prinzip her des hier wär...: private void Form2_Load(object sender, EventArgs e) { Form1.textBox1.Font = new Font("Microsoft Sans Serif", 8, FontStyle.Regular); }
[C#]Textbox aus Form1 in Form2 auslesen...
10/30/2012 - .NET Languages - 22 Replies
Hallo, ich bin gerade dabei, ein Programm zu erstellen, welches 2 Forms besitzt. Die zweite Form wird von einem neuen Thread erstellt (also mit System.Threading.Thread). Wie kann ich den Wert, der in einer Textbox, von der Form1 ist, in der Form2 auslesen bzw. benutzen? Auf der Form2 habe ich keine Textbox (ich kann den Wert also nicht einfach in eine andere Textbox übernehmen). Es sollte in der Form2 in einer Variable gespeichert werden. Ich bedanke mich schonmal, für jeden hilfreichen...
[Frage] Visual Basic Form2 zu Form1 machen
09/04/2012 - .NET Languages - 7 Replies
Hallo ich habe eine Frage. Ich habe ein Projekt erstellt und möchte jetzt das die Form2 als erstes geöffnet wir (als "Startseite") wie bekomme ich das hin?
[FRAGE] Form2 aus Form1 heraus öffnen
04/14/2010 - AutoIt - 4 Replies
heyho, ja, nach eifrigem googlen yahoohen und Bingen ..xD bin ich dennoch nicht fündig geworden und versuche es dann mal hier :P also mein problem ist folgendes: Ich habe ein GUI mit buttons inputfeldern bla bli blubb so, nun soll ein button ein 2. GUI aufrufen in welchem wieder buttons und inputfelder sind ... läuft aber irgendwie nich so wie ich mir das vorstelle :P meine frage:



All times are GMT +1. The time now is 15:32.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.