case type from string '' to type 'double' is invalid

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

It is very strange ~~ my tab control got Page1 & Page2, there is combox box
in Page2,
in combox 's selectedindexchanged ,
For Each drInvChg In drInvInfo.GetChildRows("fk_invno")
drInvChg.Item("exrate") = 1.0 <-- problem ??
end for
Problem, when the form load , user click page2, THE above error will be
happend, I don't know what's wrong if it.
If I omit that line, eveyrthing goes fine. ??
Please help ~~~
 
Hi,

If drInvChg.Item("exrate") is expecting a string then do this:

drInvChg.Item("exrate") = "1.0"

Or if (drInvChg.Item() takes an integer for an argument instead of a string
(i.e. "exrate") then you'll need to supply an integer. Right now my guess
is the 2nd one because you can assign 1.0 to a string variable, but the
string will contain "1" instead of "1.0". Good luck! Ken.
 
drInvChg.item("exrate") is the exchange rate , it must be decmial , not a
string. I am wonder why there is an error
 
Hi,

Could you post more code. What is drInvChg? A datarow? Also what is
drInvInfo? What type of objects are these? I would put a breakpoint on
your For Each line. Then highlight drInvChg.Item("exrate") and put it in
your watch window. What type of value does it return? A String? You are
getting this error because one of your values is a string that can not be
converted to a double data type. Good luck! Ken.
 
I know where is my bug , the problem is not the dgInvCharges, the problem
belongs to the dataTable,
In my DataTable 's columnChanged and I solve it , Thanks for your kind
attention.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top