Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Set an Integer variable to a null


Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2002, 06:14 AM
carlchick
Guest
 
Posts: n/a
Default Set an Integer variable to a null


What's the script for changing an integer variable to a null variable?

I can easily change a string variable to a null. Variable 'STR' = " "

I declare a variable 'INT' an integer in the beginning of my code. I also do a check later to ensure that 'INT' is actually an integer (the variable may not be set otherwise).

I've tried using the cInt(" ") or (INT = " "....cInt(INT) but that doesn't to work. Is there an easier way of converting a null value to an Integer and vice-versa and setting a variable to null that's actually an integer variable?
Reply With Quote
  #2  
Old 11-08-2002, 06:24 AM
shmoove shmoove is offline
Senior Contributor

Retired Leader
* Expert *
 
Join Date: Sep 2002
Location: Israel
Posts: 918
Default

No you can't set an integer to null, you can set it to 0 or some other value that will stand fpr a "null" integer for your program. It depends what this integer is representing. For example if the integer represents the index of a zero-based array then -1 is a good choice for "null".
__________________
Have you tried looking right in front of you (or at least in MSDN)?
Reply With Quote
  #3  
Old 11-08-2002, 07:44 AM
reboot's Avatar
reboot reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
Default

By the way, 'STR' = " " does NOT set that variable to Null.
__________________
~ Quod non mortiferum, fortiorem me facit ~

Avatar by lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->