473,516 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

referencing a object in another form

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
Nov 20 '05 #1
2 1811
Hi,

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

Ken
---------------------
"Stan" <St**********@cs.com> wrote in message
news:02****************************@phx.gbl...
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

Nov 20 '05 #2
* "Stan" <St**********@cs.com> scripsit:
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.


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>
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1564
by: Steve | last post by:
I have a .NET windows program that has a VB.NET component and a C# component. The VB component contains the form and handles all the UI stuff. The C# component drives the engine that actually does all the work. The VB component has one form called frmX. On frmX are three text boxes (txtA, txtB, txtC) and a button (cmdAdd). When the...
6
1081
by: Christopher Weaver | last post by:
This is a broad question. I am developing a multiform Windows applications. There is only one database involved. I would like to establish one connection object and a few DataAdapters and DataSets that I can use in several of the windows. How and where do I instantiate these objects so I can utilize them from any of the forms in the...
6
11269
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
5
1794
by: Amelyan | last post by:
I am struggling here trying to determine what is a good programming practice as far as referencing your URLs. When you use Response.Redirect, do you use 1) Hard-coded string -- Response.Redirect("MyPage.aspx"); 2) Constants -- Response.Redirect(STRMyPage); // where input parameter is -> const string STRMyPage = "MyPage.aspx"; 3)...
0
1373
by: Frank | last post by:
I am attempting to convert an asp file to a asp.net file using C#. The original file has an ActiveX control which is contained in a cab file. The cab file contains the .ocx file which connects to a socket and transfers client info to a server, as well as several .dlls The cab file also references another cab file which contains files to...
17
18388
by: Paul Helmuth | last post by:
All, (here's an easy one)... This is probably a stupid question - please bare with me as I am new to dotNet. How does one reference objects on a form from a module? In 6.0 you could simply provide the form name as a prefix to the object within the form and that would do it (kind of like providing a fully qualified path name to a
2
4042
by: Axel | last post by:
Hi, a question about something that seems very simple at first glance: is it possible to reference other controls of a subform in a query window without referencing through the parent form? I want to do this as I want to use same subform on two different parent forms. Main problem is that the subform is not part of the forms collection. ...
21
5067
by: cmd | last post by:
I have code in the OnExit event of a control on a subform. The code works properly in this instance. If, however, I put the same code in the OnExit event of a control on a Tab Control of a main form, the code errors out at the 2nd line. The error number is 13 and the description is "Type mismatch". Both controls are memo fields. I suspect...
11
3498
by: ozTinker | last post by:
I'm sure this shouldn't be too difficult, but I lack familiarity with the MS object model. Suppose I have a table "Purchase_Orders" and a form "TEMP" which I am using to look up a customer's orders. The form has a text field named LastName for typing in new orders, but first let's look at the previous orders. Elsewhere on the form is a Office...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.