For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Syntax > March 2005 > Forms question (Keep it simple)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Forms question (Keep it simple)
Allain B

2005-03-18, 4:02 pm

It is really a simple question.

Visual Basic .NET (2003)

I create 2 forms (Form1 and Form2)

I create a checkbox in Form1 (checkbox1)
I create a checkbox in Form2 (checkbox1)
I go to Form1 doubleclick on checkbox1 and alters the code

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles CheckBox1.CheckedChanged
' here begin the alteration
If CheckBox1.Checked = True Then
Form2. ' here begins the problem, i want to set the control in
form2 the same as in form1


End If
End Sub

The question is very simple
Why can i not refer to a control in form2 from form1. there was no problem
in VB6

Larry Serflaten

2005-03-18, 4:02 pm


"Allain B" <Allain B@discussions.microsoft.com> wrote
> It is really a simple question.


<...>

> The question is very simple
> Why can i not refer to a control in form2 from form1. there was no problem
> in VB6


Because you did not establish a reference to the second form. VB6 gave you
a global reference, whether you used it or not. VB.Net does not hold your hand
to that extent.

This question is posted to the wrong group, however. The ...public.vb.... groups
are for questions about VB6 and prior. Look for groups with 'dotnet' in their names
for questions about .Net. For example:

microsoft.public.dotnet.languages.vb

LFS


Allain Bøge

2005-03-18, 4:02 pm

Thanks a lot Larry, trying there

"Larry Serflaten" wrote:

>
> "Allain B" <Allain B@discussions.microsoft.com> wrote
>
> <...>
>
>
> Because you did not establish a reference to the second form. VB6 gave you
> a global reference, whether you used it or not. VB.Net does not hold your hand
> to that extent.
>
> This question is posted to the wrong group, however. The ...public.vb.... groups
> are for questions about VB6 and prior. Look for groups with 'dotnet' in their names
> for questions about .Net. For example:
>
> microsoft.public.dotnet.languages.vb
>
> LFS
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com