How to check a checkbox of form 1 from another form in vb.net? -


i have 2 forms, form 1 , form 2 (windows application). how can access , check checkbox in form 1 form 2. tried calling form name , control form1.chkcanada.checked = true, did not work. , added property in form 1

public property abc boolean             return chkcanadianstmtind.checked     end     set(value boolean)         chkcanadianstmtind.checked = value     end set end property 

and in form 2

dim frm new frm1 frm.abc = true  'checked 

and still doesnt work. missing here?

alternatively can pass handle of form1 form2 constructor

form1:

public class form1    private sub button1_click(sender system.object, e system.eventargs) handles button1.click     dim _form2 new form2(me)      _form2.show()   end sub end class 

form2:

public class form2    public sub new(byval _form1 form1)      ' call required designer.     initializecomponent()      ' add initialization after initializecomponent() call.     _form1.checkbox1.checked = true    end sub   end class 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -