Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 471 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need some help - enabling checkboxes

#21
Because as I said, it exists.

If there is a CheckBox on Form1. You instantiate and show a new form (Form2), when you instantiate a new instance of Form1 from a method embedded in the Form2 class, it's no different than how you have Form1 set up in the designer. It's a clone of that blueprint of Form1...

Sorry, I was just going by what you're saying, but *Form1 (or Form2 as in your post)... It doesn't matter, if there is a CheckBox on that form, if you instantiate the form that has a CheckBox in it, it exists. That's all there is to it, doesn't matter if the form is hidden, not shown. The only time it wouldn't exist is if the control was removed from that form as it's parent container, or if the form itself doesn't exist at that point in time, because if it doesn't exist, any of the control children will not exist either.

The issue is this:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


If you declare a new instance of Form1, how is this new instance, supposed to reference the original?
Reply

#22
Quote:(03-17-2013, 03:09 AM)i0xIllusi0n Wrote:

[To see links please register here]

Why wouldn't it return an error though saying Form2 checkbox doesn't exist?

Because it does exist lol....

If you have a checkbox on Form2 then it exists. What i'm talking about is that you're trying to change a new instance of Form2, you don't Show() it, and this is NOT the one that is already open (as Form2).
Reply

#23
Adopt my example of passing the reference to Form1 in Form2's constructor when it is shown and then keep a record of that in a private variable so you can have a gateway to modify the Form1 instance directly from the Form2 instance. There's no possible way you're going to change anything on Form1 just by doing that, unless you iterate through the collection of open forms with the property Application.OpenForms, and find Form1 in this collection to use as the reference to make the modifications to.

Example of that:

Hidden Content
You must

[To see links please register here]

or

[To see links please register here]

to view this content.


Application.OpenForms returns a FormCollection which inherits a class that implements the IEnumerable interface, therefore you can use the foreach context on the collection to iterate through each internal Form and validate things that way.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through