Hallo nochmal zusammen. Da ich nun die ControlBoxen disabled habe, würde ich gerne die SubForm durch das klicken auf die Komponente schließen.
Die Komponente erstreckt sich fast über die komplette Größe der SubForm.
Den Bereich wo die Komponente nicht ist, decke ich durch:
Private Sub frmSub_Close1(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Me.Click
Me.Close()
End Sub ab.
Nun moechte ich jedoch, dass auch durch Klick auf die Komponente, meine SubForm geschlossen wird:
Private Sub frmSub_Close2(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles myComponent.Click
Me.Close()
End Sub welches mir jedoch eine NullReferenceException was unhandled wirft. Stacktrace:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="System.Windows.Forms.DataVisualization"
StackTrace:
at System.Windows.Forms.DataVisualization.Charting.Chart.get_ChartAreas()
at System.Windows.Forms.DataVisualization.Charting.Chart.OnChartMouseUp( _
MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons _
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, _
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at _
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms_
.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 _
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner( _
Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 _
reason, ApplicationContext context)
at _
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.On_
Run()
at _
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Do_
ApplicationModel()
at _
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Ru_
n(String[] commandLine)
at WindowsApplication2.My.MyApplication.Main(String[] Args) in _
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext _
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: In der entsprechenden Zeile läuft eine Endlosschleife, in der ein Thread meine Komponente mit Daten beliefert.
Komisch ist, dass die erste Methode funktioniert, die zweite jedoch nicht. |