1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Optomized compiling problems again.

Discussion in 'Questions (Windows Mobile)' started by J12345T, Sep 3, 2008.

  1. J12345T

    J12345T Member Licensed User

    Hi,

    Trying to compile and getting "Object reference not set to an instance of an object". It refers to:-

    Sub Direct_Click
    If direct.Checked=false Then
    direct.Checked=true
    Else
    direct.Checked=false
    End If

    End Sub

    Direct is a menu item and this sub controls whether it is checked or not during runtime. I've tried to addevent("direct",click,"direct_click") but it does not help. Ideas??


    Thx.

    JT
     
  2. Byak@

    Byak@ Active Member Licensed User

    direct is checkbox?
    why it is sub?when checkbox clicked,checked parametr avtomaticaly chenged.
     
  3. Byak@

    Byak@ Active Member Licensed User

    >>Direct is a menu item


    ups,sorry
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload your source code file?
     
  5. Byak@

    Byak@ Active Member Licensed User

  6. Zenerdiode

    Zenerdiode Active Member Licensed User

    I've renamed the menu item to 'Direct' and it works fine for me. You are renaming both the name and the text of the menuitem? The text may be anything but the name is the name used for your subs and code.
     

    Attached Files:

  7. J12345T

    J12345T Member Licensed User

    Thanks everyone,

    Direct is indeed a renamed menu item. The sub direct_click is used to check and uncheck the menu item such that the discrete direct.checked may be used.

    I've uploaded the source code; any help is appreciated.

    Thx.

    JT
     
  8. Cableguy

    Cableguy Expert Licensed User

    Not having ALL the files neede by the app, makes the trying to run it, a bigger effort than trying to help..
    Anyway, if I understood you rigth, you want to toggle the direct.checked state...
    So I came up with this simpler way...but couldn't try it...
    Code:
    Sub Direct_Click
    Direct.Checked= 
    Not (Direct.Checked)
    End Sub
    EDIT:After having comented a few duzen lines of code, control related, i've managed to get you app working and checked the Direct.checked behaviour, and it works as expected...
     
    Last edited: Sep 4, 2008
  9. Erel

    Erel Administrator Staff Member Licensed User

    There is a syntax error above Sub direct:
    Code:
    Sub settings

    endsub   [COLOR=Red]<-------[/COLOR]

    'Sub Setup_Tables

    'End Sub

    Sub Direct_Click
    If direct.Checked=False Then 
        direct.Checked=
    True
    Else 
        direct.Checked=
    False
    End If

    End Sub
     
  10. J12345T

    J12345T Member Licensed User

    Hi All,

    Firstly I apologise for not uploading all the files but the attachment manager for the forum wouldn't let me; don't know why...

    Secondly, thank you all for all your help. The simple syntax error was the problem; :sign0161:

    When I now run the compiler I get this message:-

    Error CS1502: The best overloaded method match for 'system.drawing.font.font(string,float,System.Drawing.Fontstyle)' has some invalid arguments

    It is probably obvious that I'm not much of a code writer however I don't even know where to begin with this one....:sign0085:

    Thanks for your patience,

    JT
     
  11. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  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