473,394 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Sharing objects across forms and other objects

Hi,

What is the best method to share objects (such as a SqlConnection)
across many forms. I am currently passing the SqlConnection in to
other forms from the main form through the other forms' constructor.
This is becoming cumbersome when dealing with dozens of forms. What
are the alternatives?

Thanks in advance,
Evan
Nov 15 '05 #1
2 2037
Set the connection as static, and access it using the
type.

Rakesh

-----Original Message-----
Hi,

What is the best method to share objects (such as a SqlConnection)across many forms. I am currently passing the SqlConnection in toother forms from the main form through the other forms' constructor.This is becoming cumbersome when dealing with dozens of forms. Whatare the alternatives?

Thanks in advance,
Evan
.

Nov 15 '05 #2
Hi evan,

You can create a class with static members for these escenario, you could
also use a singleton for this.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Evan" <ev**************@yahoo.com> wrote in message
news:8d**************************@posting.google.c om...
Hi,

What is the best method to share objects (such as a SqlConnection)
across many forms. I am currently passing the SqlConnection in to
other forms from the main form through the other forms' constructor.
This is becoming cumbersome when dealing with dozens of forms. What
are the alternatives?

Thanks in advance,
Evan

Nov 15 '05 #3

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

Similar topics

3
by: Alex | last post by:
Hi all, I want to write a "File sharing system". Is posssible with socket and thread create multisuer connection at the same time ? or is wrong my idea?? thanks
4
by: Cowboy \(Gregory A. Beamer\) | last post by:
Background: ------------- The idea started as a single sign on type of application. Having tested it before, I knew we could institute single sign on using the same Authentication Cookie name (in...
2
by: Mervin Williams | last post by:
I am using Infragistics UltraWebTab (a tab folder control for ASP.NET). My tab folder control will include five tab pages with a separate web form on each, and these web forms will share data. ...
1
by: Daryll SHatz | last post by:
Is there a way to share a datase across multiple forms in a project? I have created a DataSet, using the Wizards, and bound several controls on my main form. All works well. Now I would like to...
2
by: Michael Isaacs | last post by:
Is there any way to share an object or variable between applications other than through .NET remoting? Also, if this is the only way, what kind of overhead is there for storage (memory) and speed...
4
by: Martin Ehrlich | last post by:
Hello NG. I've got a little problem with sharing types between webservices and clients. I've created a business class with public fields within a shared assembly like: public class Item {
1
by: Matt Owens | last post by:
Hi, Im setting up a new project in which I'd like to share code across numerous other projects, specifically a control library and an array of common objects. Im not really sure how best to go...
6
by: sekhar123276 | last post by:
Hi, I want to declare objects that several source files can use.(similar to C++ extern storage class specifier ). I know that I can pass ref to every single object(winforms) will do but I was...
45
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...

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.