I'm trying to write a Windows application that obtains
information from a web service. I can access the web
service successfully, but I can't access the object
returned by the web service in different forms.
My application is something like this:
MainForm.vb:
Public Class MainForm
Inherits System.Windows. Forms.Form
#Region " Windows Form Designer generated code "
Public Sub GetResultCollec tion( ...
Dim WebService As New ThisWebService
Dim WebServiceResul t As New ThisWebResult
Dim WebServiceEleme nt As New ThisResultEleme nt
WebServiceResul t = WebService.getR esult("paramete r")
Dim ResultForm As New myResultForm
ResultForm.Show ()
End Sub
End Class
myResultForm.vb :
Public Class myResultForm
Inherits System.Windows. Forms.Form
#Region " Windows Form Designer generated code "
Public Sub ShowResults( ...
For Each WebServiceEleme nt In
WebServiceResul t.resultElement s
myResultForm.Te xtBox.Text =
WebServiceEleme nt.textfield
End Sub
End Class
Note that objects declared in MainForm are accessed in
myResultForm. And that is the problem I'm having.
I can't figure out how to make VB .NET recognize the
objects in myResultForm.
Note ... this is a "scope of variables" problem. The web
service calls all work and if I keep everything in one
form, everything works great. But I just can't get the
objects in the first form to be "seen" in the second one.