My goal is to open Form2 from Form1 and have Form2 pass back an integer to
Form 1.
In VB, this is rather simple:
Form 1 (vanilla form with a button):
Dim WithEvents x As Form2
Dim i As Integer
Sub form2Event(ByVal num As Integer) Handles x.RouteNumber
i = num
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
x = New Form2
x.ShowDialog()
MessageBox.Show(i.ToString)
End Sub
Form 2 (vanilla form with a button)
Public Event RouteNumber(ByVal num As Integer)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
RaiseEvent RouteNumber(5)
Me.Close()
End Sub
When I look to do this simple function in C#, it appears (from the Event
Sample in the help) to involve a whole lot of coding, including creating
classes to handle the event etc. Am I just spoiled by VB.NET and its event
handling or am I misreading the C# documentation from the help files.
Thanks in advance.