|
-
Jul 9th, 2009, 11:03 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Conversion from type 'InternalField' to type 'String' is not valid.
We get this error:
Conversion from type 'InternalField' to type 'String' is not valid.
When we get to this in our code:
Code:
Dim fname2 = fname
args.Graphics.DrawString(fname2, New Font("arial", 8), Brushes.Black, 5, 5)
fname is a nvarchar variable from a recordset. It's just a name. Any ideas?
-
Jul 9th, 2009, 11:06 AM
#2
Re: Conversion from type 'InternalField' to type 'String' is not valid.
What the purpose behind that fname2 variable?
What happens when you do this?
Code:
'Get rid og fname2 and use fname directly
args.Graphics.DrawString(fname, New Font("arial", 8), Brushes.Black, 5, 5)
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Jul 9th, 2009, 11:08 AM
#3
Thread Starter
Addicted Member
Re: Conversion from type 'InternalField' to type 'String' is not valid.
-
Jul 9th, 2009, 11:10 AM
#4
Re: Conversion from type 'InternalField' to type 'String' is not valid.
It should be. That first argument needs to be a string. fname isn't a string. Try fname.ToString and see what you get.
My usual boring signature: Nothing
 
-
Jul 9th, 2009, 11:10 AM
#5
Re: Conversion from type 'InternalField' to type 'String' is not valid.
How do you assign the value to fname? Have you tried using the .ToString() method of the object?
-
Jul 9th, 2009, 11:22 AM
#6
Thread Starter
Addicted Member
Re: Conversion from type 'InternalField' to type 'String' is not valid.
we tried tostring. now we get this when we print...
ADODB.InternalField
We need to display the variable data, not whatever this.
-
Jul 9th, 2009, 11:30 AM
#7
Re: Conversion from type 'InternalField' to type 'String' is not valid.
Yeah, what you got there is the name of the type of fname. Obviously, it is NOT a string. Therefore, -0 asked the right question: How are you setting fname, as it is not what you think it is?
My usual boring signature: Nothing
 
-
Jul 9th, 2009, 11:30 AM
#8
Re: Conversion from type 'InternalField' to type 'String' is not valid.
w/o knowing what fname is dimemd as, this is a stab inthe dark, but, it could be that fname is a field.... not the field's value... this is also an example of why Option Strict and Option Explicit are a good idea.
-tg
EDIT - dang, that's what I get for letting it sit before replying... additionaly, is there a reason you're using ADODB and not ADO.NET?
-
Jul 9th, 2009, 11:30 AM
#9
Re: Conversion from type 'InternalField' to type 'String' is not valid.
Oh yeah: It is possible that fname.Value.ToString will work, but that's just a shot in the dark, at this point.
EDIT: WOOHOO! Not only did I match TG's guess, I even came close to using his exact metaphor.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|