473,395 Members | 1,968 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,395 software developers and data experts.

Weird integer behaviour

Having upgraded my VB6 project ....

This doesn't work

dim i as integer

For i = 0 to 8
MyRecordset.Fields(i).Value = "Test" <---------- Error thrown here
"item or variable not found in collection'
next i
This does :

dim i as integer

For i = 0 to 8
MyRecordset.Fields(CInt(i)).Value = "Test"
next i
Weird huh ? I could understand it if i was an object, but not a primitve
(althought I notice that even primitives have inbuilt methods now)


Nov 20 '05 #1
2 1006
"Jethro" <Je*******@hotmail.com> schrieb
Having upgraded my VB6 project ....

This doesn't work

dim i as integer

For i = 0 to 8
MyRecordset.Fields(i).Value = "Test" <---------- Error thrown
here
"item or variable not found in collection'
next i
This does :

dim i as integer

For i = 0 to 8
MyRecordset.Fields(CInt(i)).Value = "Test"
next i
Weird huh ? I could understand it if i was an object, but not a
primitve (althought I notice that even primitives have inbuilt
methods now)


Are you *sure* this is the real code? It's obvious that you didn't copy it
from VB. Can you post the real code, including the declarations? I don't
believe that the difference comes from CInt.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
guy
if you cursor over the variable i in MyRecordset.Fields(i).Value = "Test
what does VS show the type to be

guy
Nov 20 '05 #3

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

Similar topics

7
by: Jon Combe | last post by:
I have created the following test SQL code to illustrate a real problem I have with some SQL code. CREATE TABLE JCTable ( CustomerName varchar(50) ) ALTER TABLE JCTable ADD CustomerNo int...
10
by: Chris Mantoulidis | last post by:
I see some really weird output from this program (compiled with GCC 3.3.2 under Linux). #include <iostream> using namespace std; int main() { char *s; s = "test1"; cout << "s = " << s << "...
4
by: gautam | last post by:
can anyone pls tell me y is the memory allocation not alligned to 4 Bytes. Note : compiled with gcc in linux 9 void function(int a,int b,int c) { char buffer1; Bytes allocated(as shown by gdb)...
14
by: Nak | last post by:
Hi there, It's probably me being weird more than the function but I'm having problems with it doing as it should. I have a C++ application with 2 resources of custom types, RT_INIFILE @...
38
by: baong | last post by:
dear all i have use this line to time in many my web base appl. but now i found a weird problem the javascript line is the same but i use the calculation 2 time @ the first time, it is ok, 3 *...
7
by: Vmrincon | last post by:
Hi everybody! I am trying to program a function in javascript and a funny behaviour occurs. If I execute this code: aux=parseInt(year-birthyear); return (aux)
1
by: Paul H | last post by:
I have an Employees table with the following fields: EmployeeID SupervisorID Fred Bob Bob John Bob Mary Bill Bill I have created a self join in...
5
by: bdsatish | last post by:
How does (a/b) work when both 'a' and 'b' are pure integers ? 4 -5 Why is it -5 ? I expect it to be -4 ? Because, in C/C++, 9/2 is 4 and so negative of it, (-9/2) is -4. What should I do...
14
by: leptone | last post by:
Dear all, I am programming a PLC with an 80188 processor, hence I am using an old version of Borland C++ (3.10). While doing the job, I've encountered strange behaviours and I've isolated the...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.