473,387 Members | 3,781 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,387 software developers and data experts.

Issues with scope on a text box after .net conversion from vb6

Sorry for posting on multiple groups with this, I am new to the groups
and didnt know the possibility of "cross-posting" was possible.
Anyway, my post in the "upgrade" group hasnt gotten any response
(probably due to noone reading it there) so I figured I would move this
here for beter coverage.

I've got a vb6 app that references a COM DLL. It is a single form app
with and input textbox, a single button and a output textbox.

When the user types into the input box and clicks the button, the app
invokes a method from the DLL.

an event fires when the DLL returns the results from the request and
displays it in the text box.

here is the calls being used in the DLL:

void Request (BSTR bsWhat, long lHowmany)
bsWhat - [in] What you want to retrieve data for
lHowMany - [in] The maximum number of data points to be retrieved

and then:

STDMETHOD OnDataCompleted (INT iHowmany, VARIANT Time, VARIANT Data)
iHowmany - [out] The number of data points returned.
Time - [out] OLESafeArray containing timestamps for each data point
Data - [out] OLESafeArray containing the datapoints
so, without pasting all of the code, here are the relevent parts:

first vb6

Dim WithEvents lookup As LookupInterface ' COM object

Private Sub Form_Load
Set lookup = new LookupInterface
End Sub

Private Sub Button_Click()
lookup.Request(input.text, 10)
End Sub

Private Sub lookup_OnDataCompleted(ByVal lHowmany As Long, ByVal aTime
As Variant, ByVal aData As Variant)
Dim i as long
For i = 0 to lHowmany
Output.Text = Output.text & aTime(i) & aData(i) & vbcrlf
Next i
end sub
this code works perfectly in vb6... when i loaded the project in vb.net
2005 and ran the conversion wizard, the code is now:

Friend Class LookupClass
Dim WithEvents lookup As LookupInterface ' COM object

Private Sub Form_Load
lookup = new LookupInterface
End Sub

Private Sub Button_Click()
lookup.Request(input.text, CInt(10))
End Sub

Private Sub lookup_OnDataCompleted(ByVal lHowmany As Integer, ByVal
aTime As Object, ByVal Data As Object) Handles lookup.OnDataCompleted
Dim i as integer
For i = 0 to lHowmany
'UPGRADE_WARNING: Couldn't resolve default property of object
Data(i).
'UPGRADE_WARNING: Couldn't resolve default property of object
aTime(i)
Output.Text = Output.text & aTime(i) & aData(i) & vbcrlf
Next i
End Sub
End Class
Now...this works fine as well in 2k5 with the exception that the data
never gets displayed in the output box.

upon debugging, when the data is returned in the arrays, everything
looks fine, but the Output.Text shows that it appears to be out of
scope giving an 'error: cannot obtain value'

any ideas as to why this might be happening?

Sep 20 '06 #1
2 1312
Hello ki******@gmail.com,

Why in the Hell would you run a conversion wizard on such a small chunk of
code. Be a damn programmer, ya lazy-ass.

-Boo
Sorry for posting on multiple groups with this, I am new to the groups
and didnt know the possibility of "cross-posting" was possible.
Anyway, my post in the "upgrade" group hasnt gotten any response
(probably due to noone reading it there) so I figured I would move
this
here for beter coverage.
I've got a vb6 app that references a COM DLL. It is a single form app
with and input textbox, a single button and a output textbox.

When the user types into the input box and clicks the button, the app
invokes a method from the DLL.

an event fires when the DLL returns the results from the request and
displays it in the text box.

here is the calls being used in the DLL:

void Request (BSTR bsWhat, long lHowmany)
bsWhat - [in] What you want to retrieve data for
lHowMany - [in] The maximum number of data points to be retrieved
and then:

STDMETHOD OnDataCompleted (INT iHowmany, VARIANT Time, VARIANT Data)
iHowmany - [out] The number of data points returned.
Time - [out] OLESafeArray containing timestamps for each data point
Data - [out] OLESafeArray containing the datapoints
so, without pasting all of the code, here are the relevent parts:

first vb6

Dim WithEvents lookup As LookupInterface ' COM object

Private Sub Form_Load
Set lookup = new LookupInterface
End Sub
Private Sub Button_Click()
lookup.Request(input.text, 10)
End Sub
Private Sub lookup_OnDataCompleted(ByVal lHowmany As Long, ByVal aTime
As Variant, ByVal aData As Variant)
Dim i as long
For i = 0 to lHowmany
Output.Text = Output.text & aTime(i) & aData(i) & vbcrlf
Next i
end sub
this code works perfectly in vb6... when i loaded the project in
vb.net 2005 and ran the conversion wizard, the code is now:

Friend Class LookupClass
Dim WithEvents lookup As LookupInterface ' COM object
Private Sub Form_Load
lookup = new LookupInterface
End Sub
Private Sub Button_Click()
lookup.Request(input.text, CInt(10))
End Sub
Private Sub lookup_OnDataCompleted(ByVal lHowmany As Integer, ByVal
aTime As Object, ByVal Data As Object) Handles lookup.OnDataCompleted
Dim i as integer
For i = 0 to lHowmany
'UPGRADE_WARNING: Couldn't resolve default property of object
Data(i).
'UPGRADE_WARNING: Couldn't resolve default property of object
aTime(i)
Output.Text = Output.text & aTime(i) & aData(i) & vbcrlf
Next i
End Sub
End Class
Now...this works fine as well in 2k5 with the exception that the data
never gets displayed in the output box.

upon debugging, when the data is returned in the arrays, everything
looks fine, but the Output.Text shows that it appears to be out of
scope giving an 'error: cannot obtain value'

any ideas as to why this might be happening?

Sep 21 '06 #2
Thanks for the insightful, slightly preddictable, response.

This project was part of a much larger solution (about 30 apps in all).
It is one of about 5 that didnt convert correctly all of which have
the same problem.

Sep 22 '06 #3

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

Similar topics

1
by: anton muhin | last post by:
In addition to s hack, I'd like to suggest the following code. Any comments are highly appreciated: class Scope(object): pass def accumulator(): scope = Scope() scope.n = 0 def f(n):
2
by: Alex Holcombe | last post by:
 One thing that attracted me to Python was the prospect of significantly shorter debugging times and debug-execution cycles thanks to Python being an interpreted rather than compiled language. In...
1
by: | last post by:
Can anyone point me to a good resource to show me what potential problems I'll have converting from Access 2000 to Access 2003? I understand that 2003 can read and work with the 2000 files, but that...
8
by: TTroy | last post by:
I have a few questions about "scope" and "visibility," which seem like two different things. To me "visibility" of the name of a function or object is the actual code that can use it in an...
3
by: Chris | last post by:
Hi, I am learning object oriented programming. I am always running into scope issues in my C# ASP.NET applications. example: a public void methods: My intellisense does not does up for...
3
by: Jay Balapa | last post by:
Hello, I have been handed a VB.net windows compact framework project. Code contains lot of legacy issues to deal with like modules. Previous programmer has used modules all over the place. Scope...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
3
by: =?Utf-8?B?U0FM?= | last post by:
I have not used Delegates before and I am having trouble using them in my app. Here is what I am doing. 1. I have created a C# InterOp Dll that I make calls to, that in turn calls methods in a...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.