-
Jul 29th, 2021, 10:03 AM
#1
Thread Starter
Member
Invoke Event Call Backs
Hi,
I am trying to work out why my program is erroring on load.
It is because of Phidget22.Phidget.InvokeCallbacks = True on debug its coming up as False and then throws a error.
Is there anyway i can turn this on.......
i am trying to develop a RFID Clocking in system with a SQL DB backend and the RFID companies code works correctly with the same code lines were mine does not.
Thanks in advance,
James
-
Jul 29th, 2021, 11:27 AM
#2
Re: Invoke Event Call Backs
Instead of taking a screenshot of the code, could you copy/paste the code inside of [CODE][/CODE] tags?
-
Jul 29th, 2021, 12:06 PM
#3
Thread Starter
Member
Re: Invoke Event Call Backs
Originally Posted by dday9
Instead of taking a screenshot of the code, could you copy/paste the code inside of [CODE][/CODE] tags?
When I get back into the office will post the code what areas do you require?
-
Jul 29th, 2021, 01:04 PM
#4
Re: Invoke Event Call Backs
Presumably the part you have screenshotted.
-
Jul 29th, 2021, 08:16 PM
#5
Re: Invoke Event Call Backs
Originally Posted by VBJames
what areas do you require?
The parts that you think are relevant to the problem.
-
Jul 29th, 2021, 10:02 PM
#6
Re: Invoke Event Call Backs
I don't usually need to add code to the New method, but I think if I did, I would add it after the comment where it says "Add any Initialization...".
Adding code before the components are initialized seems like you're asking for problems.
I could be wrong though, since I haven't added code to the method (that I can remember.... I'm old).
"Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930
-
Jul 30th, 2021, 01:56 AM
#7
Thread Starter
Member
Re: Invoke Event Call Backs
Here is the code
Code:
Imports System.Runtime.InteropServices
Imports System.Data.SqlClient
Imports System.Data
Imports Phidget22
Imports Phidget22.Events
Public Class Form1
Dim WithEvents device As Phidget22.RFID
Dim open As ExampleUtils.ExampleUtils.CommandLineOpen
Dim errorBox As ErrorEventBox
Dim runonce As Boolean = False
Public Sub New()
open = New ExampleUtils.ExampleUtils.CommandLineOpen(Me)
' This call is required by the Windows Form Designer.
Phidget22.Phidget.InvokeEventCallbacks = True
InitializeComponent()
' Add any initialization after the InitializeComponent() Call.
End Sub
Public Sub New(ByVal commandLine As String())
open = New ExampleUtils.ExampleUtils.CommandLineOpen(Me)
open.commandLine = commandLine
Phidget22.Phidget.InvokeEventCallbacks = True
InitializeComponent()
End Sub
When i debug the
Code:
Phidget22.Phidget.InvokeEventCallbacks = True
is showing as False.
Cheers James
-
Jul 30th, 2021, 02:22 AM
#8
Re: Invoke Event Call Backs
So as suggested in post #6, the auto-generated comment explicitly states that you should put your initialisation code after the call to InitializeComponent and yet you have ignored that and put it first. Why would you think that that was a good idea? Fix that obvious issue and then get back to us if there's still an issue.
Also, your constructors are wrong. You should put everything you can into the parameterless constructor and then, unless it's impossible for some reason, call the parameterless constructor in the other one:
vb.net Code:
Public Sub New()
InitializeComponent()
'Your code goes here, as is clear simply by reading what's in front of you.
End Sub
Public Sub New(ByVal commandLine As String())
Me.New()
open.commandLine = commandLine
End Sub
-
Jul 30th, 2021, 06:34 AM
#9
Thread Starter
Member
Re: Invoke Event Call Backs
I have done as jmcilhinney advises but the same issue
Phidget22.Phidget.InvokeEventCallbacks = True is still false on debug and crashes.
Cheers James
-
Jul 30th, 2021, 09:23 AM
#10
Re: Invoke Event Call Backs
Show us the actual code you have now and indicate exactly where the exception is thrown. You have no idea the number of times that people have indicated that they have done as instructed but it still didn't work, only for us to find out later than they didn't do as instructed at all. If you want help with something that doesn't work, ALWAYS show us what that is. If you make changes, show us the new code. NEVER make us assume or guess because if we assume or guess incorrectly then it's a waste of our time and yours.
-
Jul 30th, 2021, 10:27 AM
#11
Thread Starter
Member
Re: Invoke Event Call Backs
Thanks for all the help I have worked it and my app is running correctly and can now start developing it.
Cheers James
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|