Solved

VB.Net: Changing control properties from outside the form

Posted on 2014-01-16
3
406 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 70

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.net Open video relating to control 2 33
Data organization issue 7 40
VB.Net - BackgroundWorker running multiple 5 47
Asp.Net Session Question 2 36
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

696 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