473,396 Members | 1,847 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.

Object Type Conversion Error

Hello all, and thank you in advance!

The below code keeps giving me the error:
Conversion from type 'Object()' to type 'Integer' is not valid.

Do I need to do some casting or somethign?

All I'm doing is passing an object which contains a structure,
Dictionary(type Integer, string) and a
system.directoryservices.searchresultcollection.

Dim ControlThreadVals As Object = New Object() {svrInfo,
dcDict, svrResults}
Try
'******Here's where I get the error: *********************
controllerThread = New System.Threading.Thread(AddressOf
ControlThread, ControlThreadVals)
'************************************************* *******
controllerThread.IsBackground = True
controllerThread.Start()

While controllerThread.IsAlive
Application.DoEvents()
End While

Catch ex As Exception
Dim strErr As String = ex.Message
Debugger.Break()
End Try

Dec 21 '06 #1
3 919
Ooops, sorry! The while loop is actually outside the try catch block,
as below.
Dim ControlThreadVals As Object = New Object() {svrInfo,
dcDict, svrResults}
Try
'******Here's where I get the error: *********************
controllerThread = New System.Threading.Thread(AddressOf
ControlThread, ControlThreadVals)
'************************************************* *******
controllerThread.IsBackground = True
controllerThread.Start()

Catch ex As Exception
Dim strErr As String = ex.Message
Debugger.Break()
End Try

While controllerThread.IsAlive
Application.DoEvents()
End While

Dec 21 '06 #2
Bmack500 wrote:
Dim ControlThreadVals As Object = New Object() {svrInfo,
dcDict, svrResults}
Try
'******Here's where I get the error: *********************
controllerThread = New System.Threading.Thread(AddressOf
ControlThread, ControlThreadVals)
'************************************************* *******
Well, according to the docs, none of the constructors for the Thread
class takes an object array as a parameter. Since ControlThreadVals is
an object array and not an integer, it produces the exception you are
seeing.

Dec 21 '06 #3
Oh, I see. I had a similiar section in my code, but I had it wrapped in
a class first.

Thanks!

Chris Dunaway wrote:
Bmack500 wrote:
Dim ControlThreadVals As Object = New Object() {svrInfo,
dcDict, svrResults}
Try
'******Here's where I get the error: *********************
controllerThread = New System.Threading.Thread(AddressOf
ControlThread, ControlThreadVals)
'************************************************* *******

Well, according to the docs, none of the constructors for the Thread
class takes an object array as a parameter. Since ControlThreadVals is
an object array and not an integer, it produces the exception you are
seeing.
Dec 21 '06 #4

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

Similar topics

16
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
9
by: Andy Sutorius | last post by:
Hi, I am receiving the error when compiling the project, "cannot implicitly convert type object to string". The error points to this line of code and underlines the dtrRecipient:...
3
by: Brian Henry | last post by:
If i have a structure type and i place the structures data into a tag property (which is an object) it will go in obviously, but when i pull an object back into a structrured type it will error.....
7
by: Dave Taylor | last post by:
I have a DataTable with three string columns, "Value", "Format" and "Type" However, some of the rows contain numbers and dates in the Value field. So I would like to be able to format the output...
2
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
21
by: phpCodeHead | last post by:
Code which should allow my constructor to accept arguments: <?php class Person { function __construct($name) { $this->name = $name; } function getName()
1
by: =?Utf-8?B?QkpT?= | last post by:
I have written a Generic method that takes an object, a type, T, and returns a System.Nullable (Of T) depending on whether or not the object IsDBNull. It was working fine until I tried to pass a...
2
by: Rahul | last post by:
Hi Everyone, I was working around object slicing (pass by value) and was wondering how it is specified in the standard, class A { }; class B: public A
4
by: Man4ish | last post by:
namespace ve/////////////////ve.h { struct VertexProperties { std::size_t index; boost::default_color_type color; }; }...
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?
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
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
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.