vb.net (multipal forms ) coding pls help

  • Thread starter Thread starter Helpfuldarren
  • Start date Start date
H

Helpfuldarren

I have just upgraded from vb6 to vb.net. bought myself a book. not a very
good one !
In vb6 to execute the code on form1(command1) from form2 the code would be
form1.command1 = true ' that easy
According to my .net book it should be totally changed to something like.

FORM1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim nefrm As New Form2
Me.AddOwnedForm(nefrm)
nefrm.Show()
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' code here for button 1
Stop ' halt program
End Sub
-----------------------------------------------------------------------------------------------
FORM2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim oldfrm As Form1
oldfrm = Me.Owner
oldfrm.Button1.Visible = False ' this works
'************WHAT SHOULD I DO TO EXECUTE THE CLICK EVENT******************
'***********oldfrm.button1.value = true******************** wont code
End Sub

i'm sure its quite simple to someone who knows.
 
Hi Helpfulldarren,

The use of forms was in VB6 not that correct done. Therefore it was made
easy.

In VBNet you have
a form.show
a form.showdialog
a form.show with a form which has frm1.mdiparent = me

You have one of those forms.
When you have a simple dialog, mostly the showdialog is the best to use,
something as

\\\
frm as new form2
frm.showdialog
myvariable = frm.TheUsedProperty
frm.dispose
////
I hope this helps?

Cor
 
Back
Top