ERROR on compiling

Discussion in 'Questions (Windows Mobile)' started by superbabicka, Aug 15, 2008.

  1. superbabicka

    superbabicka Member Licensed User

    Hi, I have this errorwhen I want to compile exe -desktop application

    Error compiling program.
    Error message: error C51502: The best overloaded method match for 'system.Drawing.Font.Font(string, float, System.Drawing.FontStyle)' has some invalid arguments.

    Is there are some old dll version Like FormLib?
    I see on the forum, and I find one post for this error, but there are no explain what to do?

    Please Help!
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you post your code?
  3. superbabicka

    superbabicka Member Licensed User

    Oh, there is bigger code, but

    I send you my source of application like attachment, because there are too many images also, and db. So i think that it will be done if I send you only source code.

    OK, so there are is 3 forms, one is "master" form, second is for account change after login, and third is for open application, like image on startup (with no Windows borders).
    Also I use here WebBrowser.dll to manage these data from this application , directly to web server database (access), using outgoing forms, and sessions.

    Actually this is Stock house application, and clients can review his data online, but administration is on some local computer with internet connection.

    also I use FormLib to make image buttons better design (noBold Text, and on someone i use Tahoma font) - i think that here is the problem, but i try to rid that, and nothing. I remove FormLib library, and all flb in code, and again - nothing.

    My mistake is that I work allot of time on this, and only once i compiled , and now after 10 days work, when I try to complie - app down.

    thank you very much for your future help. I don't think that you don't have solution.
    Thank you for your replay!

    Regards for all Basic4PPC team!
    Last edited: Aug 15, 2008
  4. superbabicka

    superbabicka Member Licensed User

    Oh Nooo!

    I unCheck button in Dbasic -"Optimize Compiled", and I compile my app with no problem.

    OK, there is some error like ActiveX"456-34-34-7-6--- some numbers", but now is easy :):sign0060:

  5. agraham

    agraham Expert Licensed User

    The problem is with fractional font sizes
    _panex3txt2.Font = new Font(_panex3txt2.Font.Name,10.5,_panex3txt2.Font.Style);
    'Argument '2: cannot convert from 'double' to float'
  6. Erel

    Erel Administrator Staff Member Licensed User

    @agraham, do you know which line creates this code?
  7. agraham

    agraham Expert Licensed User

    There are lots, it's a generic optimising compiler 'problem'. Just put a textbox on a form and set its font size to a decimal and it will give that error on optimised compilation. The C# compiler thinks "10.5" is a double while Font() wants a float but the compiler won't downcast automatically and errors without a cast.
  8. Erel

    Erel Administrator Staff Member Licensed User

    Thanks. I now see it too.
    It will be fixed in the next version. In the meantime you can change the FontSize property from your code (TextBox1.FontSize = 10.5) instead of the designer.
  9. superbabicka

    superbabicka Member Licensed User

    Thank you Erel and Agrham!
    You are the best.

    So, what's happen if I compile without "Optimized Compilation"... ?
    Is there will be some bug in the exe, or this option is added only to make applications smaller size for PDA ans smart phones?

    Anyway this is desktop version, so app size is not a problem so much.

  10. agraham

    agraham Expert Licensed User

    If legacy (non-optimised) compiled your application will run more slowly, no libraries will be merged with your exe and will only need .NET 1.1 on your target machine unless you are using any libraries that need .NET 2.0.

    An optimised compiled app will run about three or four times faster, will have most if not all libraries merged (as long as their source is in the Libraries folder) but will need .NET 2.0 or later on the target machine.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice