User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 10 Feb 2005, 14:31   #1
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
VB - checking if a variable is set

I'm still cleaning up the old mess at work and I've run into a problem of someone not checking if an ADO recordset is set (with new, or set) or not.
Being used to C++ I tried isNull, but that doesn't seem to work here in VB. Neither does isSet.
So, what function would I need to see if the object is set or not?
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 10 Feb 2005, 15:07   #2
pablissimo
Henry Kelly
 
pablissimo's Avatar
 
Join Date: Apr 2000
Posts: 7,374
pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.pablissimo has ascended to a higher existance and no longer needs rep points to prove the size of his e-penis.
Re: VB - checking if a variable is set

IsEmpty and IsNull both work in VBScript, don't know about VB proper though.
__________________
You're now playing ketchup
pablissimo is offline   Reply With Quote
Unread 10 Feb 2005, 15:17   #3
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Re: VB - checking if a variable is set

IsEmpty doesn't work either
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 11 Feb 2005, 00:45   #4
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: VB - checking if a variable is set

Hmmmmmm... Tried IsMissing()?
IsEmpty() and IsNull() sort of SHOULD work actually...
And there is no IsNothing :-/

Maybe try:
If Var = Nothing ???
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Unread 11 Feb 2005, 00:52   #5
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: VB - checking if a variable is set

Hmmm, THIS is strange. My German help says:
Quote:
Originally Posted by German Visual Basic 6.0 Help for Function IsObject()

Verwenden Sie eine Fehlerbehandlungsroutine, um sicherzustellen, daß ein Objektverweis gültig ist. Mit Hilfe der IsNothing-Funktion können Sie feststellen, ob ein Objektverweis auf Nothing gesetzt wurde.
Quote:
Originally Posted by Rough translation by myself

Use an errorhandling subroutine to make sure that an object reference is valid. Using the IsNothing-Function you can check wether an object reference was set to Nothing.

It clearly mentions an IsNothing()-Function, which doesn't seem to exist though :-/

Maybe google can help?
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Unread 11 Feb 2005, 08:13   #6
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Re: VB - checking if a variable is set

IsObject doesn't work
var = nothing doesn't work
IsNothing doesn't exist

Google didn't know yesterday, but I'll ask it again.
These are those things that I really don't like about VB
Inconsistencies.
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 14 Feb 2005, 10:46   #7
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Re: VB - checking if a variable is set

Bugger... var Is Nothing works, instead of var = Nothing.
Details, details.
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 14 Feb 2005, 14:03   #8
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: VB - checking if a variable is set

Woah. Would've never gotten that on my own.
So you're using it like
If myObject Is Nothing Then
now, ai?

Good to know...
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 00:18.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018