473,698 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

checking if instatiated

In my existing Powerbuilder application I have several statements that check
to make sure an object is instatiated.

ie. If isvalid(form1) then....

Is there a way to check for this in VB.NET? I have pasted the definition of
IsValid from Powerbuilder.

I appologize for being such a newbie.

IsValid PowerScript function

Description
Determines whether an object variable is instantiated-whether its value is a
valid object handle.
Syntax
IsValid ( objectvariable )
Argument Description
objectvariable An object variable or a variable of type Any-typically a
reference to an object that you are testing for validity

Return value
Boolean. Returns true if objectvariable is an instantiated object. Returns
false if objectvariable is not an object, or if it is an object that is not
instantiated. If objectvariable is null, IsValid returns null.

Usage

Use IsValid instead of the Handle function to determine whether a window is
open.

Dec 20 '05 #1
3 2007
Hi,

Use is nothing.

If frm is nothing then frm = new form1

Ken
-----------------

"The Other Mike" wrote:
In my existing Powerbuilder application I have several statements that check
to make sure an object is instatiated.

ie. If isvalid(form1) then....

Is there a way to check for this in VB.NET? I have pasted the definition of
IsValid from Powerbuilder.

I appologize for being such a newbie.

IsValid PowerScript function

Description
Determines whether an object variable is instantiated-whether its value is a
valid object handle.
Syntax
IsValid ( objectvariable )
Argument Description
objectvariable An object variable or a variable of type Any-typically a
reference to an object that you are testing for validity

Return value
Boolean. Returns true if objectvariable is an instantiated object. Returns
false if objectvariable is not an object, or if it is an object that is not
instantiated. If objectvariable is null, IsValid returns null.

Usage

Use IsValid instead of the Handle function to determine whether a window is
open.

Dec 20 '05 #2
"The Other Mike" <md*****@nospam .com> schrieb
In my existing Powerbuilder application I have several statements
that check to make sure an object is instatiated.

Every object is instantiated. Otherwise there wouldn't be an object. The
object is an instance of a type.

Maybe you want to check whether a variable points to an object. This is only
possible with reference types:

dim f as form1
if f is nothing then
msgbox "f does not point to an object"
else
msgbox "f points to an object"
end if
Armin

Dec 20 '05 #3
You both were correct. It works great.

Thanks

"Armin Zingler" <az*******@free net.de> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
"The Other Mike" <md*****@nospam .com> schrieb
In my existing Powerbuilder application I have several statements
that check to make sure an object is instatiated.

Every object is instantiated. Otherwise there wouldn't be an object. The
object is an instance of a type.

Maybe you want to check whether a variable points to an object. This is
only possible with reference types:

dim f as form1
if f is nothing then
msgbox "f does not point to an object"
else
msgbox "f points to an object"
end if
Armin

Dec 20 '05 #4

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

Similar topics

6
14313
by: Web Developer | last post by:
Hi, I come across the term "type checking" very often in my readings on C++, and have never heard it in Java. Besides the simplistic answer that it checks the "type", what more does it mean? WD
22
4907
by: Qopit | last post by:
Hi there, I'm pretty new to Python and am trying to figure out how to get "will this code compile?"-like code checking. To me this is a pretty basic language/environment requirement, especially when working with large projects. It is *much* better to catch errors at "compile-time" rather than at run-time. One thing I've "found" is the PyChecker module (conveniently embedded in SPE), but it doesn't seem to do that great of a job. ...
6
3143
by: Don Stewart | last post by:
From within a .NET 1.1 application and using C# Code, I need to get a list of all the instatiated objects in the application, with the following columns: TypeName, Instatiation-Count, Size I was thinking of using the Garbage Collector somehow or perhaps a Heap and Stack Dump? Using an external utility application is NOT an option. Does anyone have any ideas?
3
1115
by: lopamudra pathak via DotNetMonster.com | last post by:
Hi, I am checking the spells in my rich text box. Now whenever the page is laoded the WINWORD.EXE get instatiated and after it is auto deleted. This spell checking is working fine. But I want to know will it be possbile without using WINWORD.EXE? The system which is not having MSOffice, there my code will fail. can anybody help me to check the spells w/o instatiating the WINWORD.EXE? Thanks. This is the working code which is using the...
4
2379
by: Patient Guy | last post by:
Does anyone have any coding rules they follow when doing argument checking? When arguments fail during check, do you return from the call with an ambiguous return value, or do you throw exceptions?
16
2625
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project where someone suggested to me I was spending too much time writing error messages, and that I was therefore missing the benefit of using a scripting language. The idea, apparently, is that the PHP interpreter writes all the error messages that are...
125
6560
by: jacob navia | last post by:
We hear very often in this discussion group that bounds checking, or safety tests are too expensive to be used in C. Several researchers of UCSD have published an interesting paper about this problem. http://www.jilp.org/vol9/v9paper10.pdf Specifically, they measured the overhead of a bounds
7
2621
by: polas | last post by:
Afternoon everyone. I have a quick question about standard C. Generally speaking, in my experience, whenever one accesses an array there is never any bounds checking done (either statically during compilation or dynamically during runtime.) However, I was wondering if whether there is anything defined in the standard about this. The reason for this is I have some code conforming to ANSI C99 and wish to write to both arrays and a block...
4
2963
by: BillE | last post by:
I have found articles on line about using word interop for spell checking with visual studio applications. Most of the articles are several years old, though - VS2003, maybe 2005. I couldn't find anything for VS2008. Are there any new improvements in spell checking with VS2008? Thanks Bill
0
8683
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
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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
9031
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
7739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
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...
1
3052
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
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.