dcsimg
Results 1 to 13 of 13

Thread: Late bound resolution, implicit conversion from double to integer warning

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    214

    Late bound resolution, implicit conversion from double to integer warning

    Hello ,

    I'm getting late bound resolution warning with my following code

    Code:
    dim MyArr as double
    Dim a as double, b as double, c as double
    MyArr = K(Fix(a), Fix(b))(Fix(c))
    But i couldn't find to way to solve this warning
    Note: Variables should be determine as double for some reason
    Dou have any offer ?

    Thanks

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,371

    Re: Late bound resolution, implicit conversion from double to integer warning

    What is K, and which line is showing the warning?
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    214

    Re: Late bound resolution, implicit conversion from double to integer warning

    Quote Originally Posted by Shaggy Hiker View Post
    What is K, and which line is showing the warning?
    K is array like
    Dim K(10,10) as array

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,371

    Re: Late bound resolution, implicit conversion from double to integer warning

    Ok, what's it an array OF?

    You are getting an exception saying that you are converting a double to an integer. The variables you showed are all type double, so they aren't the problem directly. However, you didn't show what Fix is. It could be the VBA Fix method, but that seems unlikely. It could also be the Conversion.Fix method, but that takes an integer as an argument, and you are passing in doubles, so you'd get that exception. It could also be something else.
    My usual boring signature: Nothing

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,772

    Re: Late bound resolution, implicit conversion from double to integer warning

    Wouldn't the fact that he's using doubles for his array indices potentially be the issue? And if K is a two-dimension array, what's the (fix(c)) doing on the end there?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,371

    Re: Late bound resolution, implicit conversion from double to integer warning

    Yeah, I was wondering about that last item, but what is Fix? If it is Conversion.Fix, then there is this page:

    https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    That seems to have an error, as it looks like it takes an integer and returns an integer, but the description says it takes a double and returns an integer. So, if the example is right, then the description is wrong, and this method could be throwing the exception (since it is getting a double rather than an integer), but if the descriptions is right (and ONLY the description makes sense), then it will be returning a set of integers, so that will work as array bounds...but then what is fix(c) doing there?

    So, I guess I don't understand what that line is supposed to be doing, but it isn't doing it, whatever that it happens to be.
    My usual boring signature: Nothing

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,772

    Re: Late bound resolution, implicit conversion from double to integer warning

    There's overloads for Fix.... here's the Double version: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx

    So what I suspect is happening is they have doubles, which you can't use for array indices, and so are using Fix() to drop the decimal portion and return only the integer part, which then can be used in an array index. Which makes me suspect the whole thing being dodgy. I also wonder if it's a two-dimensional array of arrays.... in which case the third Fix() might make sense - and would also explain why it's in parens itself.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,777

    Re: Late bound resolution, implicit conversion from double to integer warning

    I would suggest a FULL and CLEAR explanation of the problem. Expecting us to work out how code should be written from code that doesn't actually succeed in doing something that we aren't aware of is simply begging for failure. Try taking the time to EXPLAIN what you're actually trying to achieve and provide ALL relevant code.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    214

    Re: Late bound resolution, implicit conversion from double to integer warning

    Quote Originally Posted by jmcilhinney View Post
    I would suggest a FULL and CLEAR explanation of the problem. Expecting us to work out how code should be written from code that doesn't actually succeed in doing something that we aren't aware of is simply begging for failure. Try taking the time to EXPLAIN what you're actually trying to achieve and provide ALL relevant code.
    First, thanks for your answers.
    This Code was not written by me. I was using this code in my vb6 project, now i'm trying to convert this to vb.net.

    Fix is vb6 function.

    Code purpose ise make interpolation and find data from K array.

    Some part of K array is

    K(3, 9) = {21.2, 27.9, 38.5, 47.2, 60.8, 77.3, 90.82, 124, 153, 178}

    Warning occured as follow (underlined part)

    MyArr = K (Fix (a), Fix (b)) (Fix (c))


    I was looking for some convert method for fix function. For example we are using Cint function to convert variable to integer.
    Last edited by levent; Mar 4th, 2018 at 06:07 AM.

  10. #10
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,094

    Re: Late bound resolution, implicit conversion from double to integer warning

    Quote Originally Posted by levent View Post
    First, thanks for your answers.
    This Code was not written by me. I was using this code in my vb6 project, now i'm trying to convert this to vb.net.

    Fix is vb6 function.
    So you just hoped we would figure this out? Do you not think something so important is worth mentioning? :/

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,371

    Re: Late bound resolution, implicit conversion from double to integer warning

    Heck, I still haven't figured it out. If anything, this makes it a bit less clear. What is Fix(c) supposed to do? If K is a two dimensional array, then K(3,9) would identify one slot in the cell. What you have written is K(3,9)(5). If K is just a double, this seems like it would be reducing to 27.9(5), if 27.9 happened to be the value in K at index (3,9), but that line wouldn't work, because 27.9(5) is meaningless.
    My usual boring signature: Nothing

  12. #12
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,772

    Re: Late bound resolution, implicit conversion from double to integer warning

    as far as I can figure, I think K is a two-dimensional array of arrays of doubles.... in short, a jagged array. K(3,9) might have {21.2, 27.9, 38.5, 47.2, 60.8, 77.3, 90.82, 124, 153, 178} but K(4,2) might have {1.3, 5, 6, 8.9,10}... maybe... I don't know. That's the only way K(3,9)(5) makes sense. Still don't know what the use of Fix is all about though. Still, it's probably not how I'd go about doing it. But I'm still not sure I know enough to know how I would do it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  13. #13
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,371

    Re: Late bound resolution, implicit conversion from double to integer warning

    Fix could be something incredibly clever...or not. In some situation, it might make sense to say, "anything in this range should get this value.", in which case, the range 1.0 to 1.9999999999 might get one value, while 2.0 to 2.99999999 could get another value. To extend this to some situation where this made sense for two dimensions makes my head hurt. The only example I can think of would be the truly odd one where you had something like decimal years and decimal days describing a two dimensional grid, each cell of which contained some graph of performance data such that you could say the offset into some decade and the day would be some decimal into the year, which would be able to uniquely identify a single day within a decade for some century, and retrieve the performance data for that day....but what a convoluted way to go about it.
    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
  •  



Featured


Click Here to Expand Forum to Full Width