[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?
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)
Re: Conversion from type 'InternalField' to type 'String' is not valid.
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.
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?
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.
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?
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?
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.