3 Simple Questions

  • Thread starter Thread starter Mr. B
  • Start date Start date
M

Mr. B

Question #1:

I've two forms (Parent = Form1, Child = Form2). How do I find the status of a
control (say RadioButton) on Form1, while I'm doing something on Form2.

VB6 use to allow you to do ==>
If Form1.rbMyButton.Checked = True then blahblahblah

How do I do this in VB.net?


Question #2:
If I have a HIDE button for my Parent Form1 (using ContexMenu and NotifyIcon),
how can I tell the "show" status of my Child Form2 so I can close it when I
hide my Parent?


Question #3:
I've seen examples where the word "NEW" is used in defining something. An
example is:

Me.bttnScan = New System.Windows.Forms.Button()
===

When and why do you 'need' to use the word "New"? I'm kinda curious.

Answers mucho appreciated!

Mr. B
 
You will find the answers to all 3 of your questions in the VB.Net
documentation where they are covered very thoroughly.
 
Q1: On Form2 you can use Me.ParentForm.RadioButton, assuming that you have
exposed 'RadioButton' as a public property on Form1.
Q2: You need to maintain the reference to your Form2 and check
Form2.Visible.
Q3: Without the New, you only create a reference variable, the New actually
creates the variable.

The biggest thing to remember, as far as I have learned now, is that in
VB.NET, basically, you create, position and set every single control and
parameter. In VB6 and before, this was all taken care of you behind the
scenes by the runtime. If you open an old FRM file from VB6, you would
actually see all these control statement blocks, that arent visible when
your in the development environment. The VB.NET development
environment/form designer does create all this for you and 'folds' it in the
program code, but you can access it.

The second biggest thing to remember is that controls don't seem to have
'Names' anymore, there are all object variables to be accessed, and the
variable 'Name' is the name of the control. For example, in VB6, there may
be a control named TextBox1, but in VB.NET there is a variable in your form
code called TextBox1, the is used with the "New" operator to create a class
TextBox, then location, size and position information is applied to that
control, and eventually the control 'variable' is added to the Form's
Controls property.

This is all very, very in-depth and complicated for poor folk coming
strictly from a VB5 or VB6 environment, luckily I have some C++ and Java
experience which really helps out.
 
I agree, with all due respect, I'm sure she is very knowledegable, but maybe
one day she will stop being so hard on mere mortals and remember that she
was once a less experienced person.
 
Richard Brown said:
Q1: On Form2 you can use Me.ParentForm.RadioButton, assuming that you have
exposed 'RadioButton' as a public property on Form1.
Q2: You need to maintain the reference to your Form2 and check
Form2.Visible.
Q3: Without the New, you only create a reference variable, the New actually
creates the variable.

Thanks... brief but explains much.

Bruce
 
Back
Top