Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

tracking variables across multiple windows with events inotify

$
0
0
This is actually a continuation of an ongoing issue I'm having but I think it should be in a new post as I'm taking a completely new path to get this feature working..

So this is what I have currently and what I'm trying to achieve

Application: A main window and a window that inserts data to the sql server.

Objective: 1) Track window open and closed status with a Boolean variable so that only 1 of that window opens at a time.
2) When Boolean variable changes to false as the window closes it fires an event to refresh my listbox. (Also not sure how I can call a sub from my "home" class so I can run the code to refresh my listbox)

Ive attempted to use a custom event and an implementation of inotify BUT when I use inotify it asks me to create a new instance of the class ive created on each window. This doesn't work for my situation as when I use the property on 1 window it doesn't seem to carry to the 2nd window or back to window 1 from that, I assume because its 2 different instances and not a single one that both objects interact with.

My MAJOR question is, is there a way for both windows to interact in the way I require, I was also thinking about creating a module with a public variable and some how hooking up an inotify class property to the variable but I haven't yet been able to make this work.

Heres my code so far.

Imports System.ComponentModel

Public Class INotifyclass
    Implements INotifyPropertyChanged

    Public Property windowopen As Boolean
        Get
            Return _windowopen
        End Get
        Set(value As Boolean)
            If _windowopen = value Then Exit Property
            _windowopen = value
            Me.onpropertychanged(New PropertyChangedEventArgs("Windowopen"))
            
        End Set
    End Property

    Private _windowopen As Boolean

    Public Event PropertyChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged

    Protected Sub onpropertychanged(ByVal e As PropertyChangedEventArgs)
        RaiseEvent PropertyChanged(Me, e)
    End Sub
End Class




Imports System.Data.SqlClient
Imports System.Data
Imports TASKS.INotifyclass

Class Home

    Public WithEvents inote As New INotifyclass

    Private Sub Label_PreviewMouseLeftButtonDown_2(sender As Object, e As MouseButtonEventArgs)
        inote.windowopen = True
        MsgBox(inote.windowopen)
        Dim newwindow As Tasks = New Tasks
        newwindow.Show()




Imports System.Data.SqlClient
Imports System.Data
Imports TASKS.INotifyclass

    Public WithEvents inote As New INotifyclass

    Private Sub Label_PreviewMouseLeftButtonDown_1(sender As Object, e As MouseButtonEventArgs)

        inote.windowopen = True
        MsgBox(inote.windowopen)
        Me.Close()
    End Sub




Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>