473,508 Members | 2,329 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 1994
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*******@freenet.de> wrote in message
news:%2****************@TK2MSFTNGP12.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
14297
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? ...
22
4868
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...
6
3137
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...
3
1099
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...
4
2337
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...
16
2591
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...
125
6470
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...
7
2608
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...
4
2942
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...
0
7225
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
7324
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,...
0
7495
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...
0
5627
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,...
1
5052
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...
0
4707
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...
0
1556
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
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...

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.