
Signature
Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com
Hello Mini-Tools Timm info at mini-tools dot com,
#1 sucks in any case (2 forms or more). I would suggest steering clear of
it.
You could make your second form act like a dialog box. Assign the DialogResult
property of your OK and Cancel buttons.. then from the first form you can
do something like:
Dim tDialog as Form2 = New Form2
' Set tDialog properties here..
If tDialog.ShowDialog(Me) = DialogResult.OK Then
' The user is always wrong, but what they hey, let em suffer.
End If
tDialog.Dispose
>> situation: i would like to update the UI of a form (main form of my
>> application) from a second form (which was called from the first).
[quoted text clipped - 16 lines]
> If you only have two forms, then #1 is probably easier. If you have
> multiple forms that you need to update, then #2 is preferred.
Mini-Tools Timm - 16 Jun 2006 05:21 GMT
> #1 sucks in any case (2 forms or more). I would suggest steering clear of
> it.
Why is that? If Form2 is always launched from Form1, a reference to Form1
can be passed into Form2's constructor. When the button in Form2 is clicked,
it can call the public UpdateUI() method in Form1 to update it. It's not a
bad way especially if the forms are loosely coupled.
> You could make your second form act like a dialog box. Assign the DialogResult
> property of your OK and Cancel buttons..
Yes, this is the preferred way if Form2 is a dialog of Form1. But from his
question, I gathered that he wanted the two forms to remain loosely coupled.
It's tough to be sure without understanding his exact problem.

Signature
Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com