denz Posted May 26, 2003 Posted May 26, 2003 ActiveForm query Hi, I have 2 radiobuttons (apart from some other controls) on a form and need to access the value (checked or unchecked) of the same from another class. I obtain a reference to the said form using ActiveForm and then using myForm.ActiveForm.Controls get access to all controls in the form. However, I can't seem to access the checked value of the control (for the radiobuttons). During compile it return an error stating that Checked is not a property of Controls collection. Any way to get around this ? Thanks for your time. Denzil Quote
*Gurus* divil Posted May 26, 2003 *Gurus* Posted May 26, 2003 The best way is to just pass an instance of the form to your procedure, like so: MyProc(Me) 'And in your class... Public Sub MyProc(f As Form1) f.MyCheckBox.Checked = True End Sub Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
denz Posted May 26, 2003 Author Posted May 26, 2003 Passing the form reference solved it. Thanks Hi Divil, Thanks for your reply. Solved the same by passing the form as reference. Cheerz, Denz Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.