Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Conversion using VB2008

Status
Not open for further replies.

jimwal0367

Programmer
Dec 3, 2005
24
GB
Just converted from VB6 to VB2008

On running my old code, I get the following error.

Conversion from type '_ComObject' to type 'String' is not valid

This is the code that is throwing the error.

trans = Trim(MyArea)

I have declared trans as a string
and MyArea as object.

MyArea is set to 'MyArea = Sess0.Screen.area(1, 28, 1, 32)'

This code used to work, does anybody have any ideas how to correct it.
 


Hi,

If you check Extra HELP. you'll see that Area is an OBJECT not STRING. As you know as an OO programmer, objects have many properties. One of the properties of the Area object is the Value property. So I vould modify to...
Code:
trans = Trim(MyArea.value)


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks seem to work at the moment - just piling through the rest of the code. Trying to change all the other errors
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top