473,396 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using the Set statement without first delcaring a variable

I'm going though some VB6 code where the Set statement is used to apparently declare and set the Object variable at the same time. I have been used to having to declare the variable first, then use the Set statement. Here's an example:

Set adapter = access.getDefaultAdapter

This stands alone, no previous declaration of the variable "adapter". When I look up the help topic of the Set statement, it doesn't mention being able to do it this way. Is this just an unwritten "feature" of VB6 or am I missing something?

Thanks,

Scott
Jan 4 '07 #1
1 2342
Killer42
8,435 Expert 8TB
I'm going though some VB6 code where the Set statement is used to apparently declare and set the Object variable at the same time. I have been used to having to declare the variable first, then use the Set statement. Here's an example: ...
This is really nothing to do with the Set statement, I believe.

If you don't use Option Explicit, then VB will create variables for you, defining them with a default type. Unless you specify otherwise (eg. DefLng for Long or DefInt for Integer) this default type will be Variant. A variant can hold pretty much anything, including an object I think.
Jan 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Rick Snagglehimer | last post by:
I keep getting an error from the following SP snippet "Line 11: Incorrect syntax near 'BY'." It runs fine without the ORDER BY clause. >>>>>>>>>>>>>>> WHERE .clientID = .userID
28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
6
by: Rudolf Bargholz | last post by:
Hi , I have the following tables ------------- PAX: Id Order_Id Name Position
13
by: Andy Baxter | last post by:
Can anyone recommend a good online guide to using objects in javascript? The book I bought (DHTML Utopia) suggests using objects to keep the code clean and stop namespace clashes between different...
9
by: John Brock | last post by:
I am trying to create a workbook where one of the worksheets contains an AutoFiltered table. It looks like it should be simple -- what I am doing is this: rng = ws.Range("MyTableRange")...
67
by: Rui Maciel | last post by:
I've been delving into finite state machines and at this time it seems that the best way to implement them is through an intense use of the goto statement. Yet, everyone plus their granmother is...
13
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new...
15
by: tshad | last post by:
Do I still need to close an object in a finally statement after a catch if it is part of a using statement? For example: FileStream fs = null; try { using (FileInfo fInfo = new...
2
by: kstevens | last post by:
Ok, the first thing i found out is that i should be using 'Public' instead of 'Global", so i did that. Here is what i tried to do (yes i have read as much as i could before i posted...... i...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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
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
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,...

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.