Solved

VB.Net: Changing control properties from outside the form

Posted on 2014-01-16
3
394 Views
Last Modified: 2014-01-21
I sometimes need to set a form's control properties from elsewhere in the code, and I'm getting strange errors whenever I try.   In my situation, I've created a checkbox that I want to change, but while running from withing another form.  Here's a sample of that code:

Dim UseCheck As System.Windows.Forms.CheckBox = MyForm.MyCheckbox
With UseCheck
    .Checked = False
    .Enabled = True
End With

Open in new window


With this code in place, the form won't open.
InvalidOperationException.png
0
Comment
Question by:PeterFrb
3 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 39788107
make sure the Modifiers property of your control is set to Public
0
 

Author Closing Comment

by:PeterFrb
ID: 39797800
Yes, thanks.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now