Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

referencing a object in another form

2 views
Skip to first unread message

Stan

unread,
Oct 25, 2003, 1:35:04 PM10/25/03
to
I have a dataset in one form that I instanciate there. I
would like to access that dataset from another form.
dim ds as new myds (myds is a dataset on the first form
and is generated from a dataAdapter on that form; it is
strongly typed).
I fill ds and then open another form. How can I reference
ds and access the data in it.
Thanks,
Stan

Ken Tucker [MVP]

unread,
Oct 25, 2003, 2:38:59 PM10/25/03
to
Hi,

You need to pass a reference to the dataset when you open the new
form.

Ken
---------------------
"Stan" <Stanle...@cs.com> wrote in message
news:029701c39b1e$530de6d0$a101...@phx.gbl...

Herfried K. Wagner [MVP]

unread,
Oct 25, 2003, 2:41:35 PM10/25/03
to
* "Stan" <Stanle...@cs.com> scripsit:

The code below shows you how to do that with a textbox control. You can
adapt it for your needs easily.

In the 2nd form:

\\\
Private m_t As TextBox

Public Sub New(ByVal ResultTextBox As TextBox)
MyBase.New()
m_t = ResultTextBox
InitializeComponent()
End Sub

' You can access the control with m_t.
///


Main form:

\\\
Dim f As New Form1(Me.TextBox1)
f.Show()
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

0 new messages