473,626 Members | 3,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking to see if Instance Exists

I know this is probably a very basic question.

Can someone tell me the syntax to check to see if an instance of an object
exists?

I want to:
If (does this instance exist) Then
.......
.......
End If
Nov 20 '05 #1
2 1250
* "twick10" <tw*****@hotmai l.com> scripsit:
I know this is probably a very basic question.

Can someone tell me the syntax to check to see if an instance of an object
exists?

I want to:
If (does this instance exist) Then


Add a shared property to your class that returns a Boolean. Inside the
class, you can maintain a counter that counts the instances of the
class.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Thanks,

Just what I was looking for.

Bob T
"twick10" <tw*****@hotmai l.com> wrote in message
news:eW******** ******@TK2MSFTN GP10.phx.gbl...
I know this is probably a very basic question.

Can someone tell me the syntax to check to see if an instance of an object
exists?

I want to:
If (does this instance exist) Then
......
......
End If

Nov 20 '05 #3

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

Similar topics

15
114200
by: Geiregat Jonas | last post by:
is using if(open("file",O_EXCL) != -1){ printf("File does exists")}else{printf("file does not exists"); } a good way of checking if a file exists or not, if not how should I do it ?
11
1449
by: Bonjour | last post by:
Hi everybody ! I' d like to check data before inserting. Select @nb = Count (idCustomer) From Customer Where company like '%' + @company+ '%' If "PEUGEOT SA" already exists, @nb > 0 if I enter "PEUGEOT". On the other hand, if "PEUGEOT" exists, @nb =0 if I enter "PEUGEOT SA".
2
2015
by: CES | last post by:
I'm sorry for the 101 question but I can't seem to get this to work... I'm tiring to test if a cookie has been created before. Everything I've seen indicates that Request.Cookies works the same in .net as it did in old asp but for some reason I'm getting "System.NullReferenceException: Object reference not set to an instance of an object" when ever I attempt to test for the cookie . It doesn't return an error if the cookie exists but...
4
6049
by: Darrel | last post by:
I'm trying to add an extra layer of error checking on a Drop Down List. The list is populated from one table, and then I select the selectedValue from another DB. While it SHOULDN'T ever happen, just incase, I want to check that the selected value actually exists as a value in the dropDownList before I actually try to select it. I've tried this:
5
8969
by: RSH | last post by:
I am using code to create a new modal form from a parent form. It is not an MDI form. I need to know if an instance of the form already exists so when the user clicks on the button I can close any previous version of the form. Here is the code I am using to create the form: frmFindReplace frmFind = new frmFindReplace(); frmFind.Show(); frmFind.PrepareForm(this.dataGridView1);
1
1357
by: brett | last post by:
If I participate in a forum that doesn't have any way to watch threads or any type of RSS, I could get the filesize of the thread I want to watch. When the filesize changes, I know there is a new post. Are there any reasons why this won't work? If the above will work, how is it different from using RSS? Or can RSS support just a regular page (no XML for RSS available)? Thanks, Brett
10
3233
by: Phil Latio | last post by:
I am inserting data into user table which contains 5 fields, sounds simple enough normally but 2 of the fields are designated as UNIQUE. If someone does enter a value which already exists, how do I capture this specific error? Would it make more sense to actually run a SELECT query first and if that returned a result, then I use that for error checking and don't run insert until select returns nothing? Cheers
7
19072
by: sprash | last post by:
Newbie question: I'm trying to determine if a file physically exists regardless of the permissions on it Using File.Exists() returns false if it physically exists but the process does not have the necessary permissions. One hack could be to check for length and that would throw a FileNotFoundException ...but there is got to be a better way!
8
17664
by: Brad Pears | last post by:
I want to check to see if a particular object exists using vb.net 2005. I have a class called clsContract. When the user clicks the 'New Contract' button, I want to check to see if a clsContract object already exists and if so what the state of that object is before doing anything else. I thought I could use ... if IsNothing(clsContract) then 'somc code
0
8269
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8642
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8512
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6125
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.