Optomized compiling problems again.

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
 

Byak@

Active Member
Licensed User
direct is checkbox?
why it is sub?when checkbox clicked,checked parametr avtomaticaly chenged.
 

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.
 

Attachments

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
 

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...
B4X:
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:

Erel

Administrator
Staff member
Licensed User
There is a syntax error above Sub direct:
B4X:
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
 

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
 
Top