I'm new to VB.net so please understand. I have a MainWindow, Frame1, Frame2 (AdFrame1), Page1.
MainWindow
loads Page1
from Frame1
on startup. In MainWindow.vb class
I have a Public Sub that makes Frame2
visible.
How would I share that Public Sub so I could use Page_Mouseup Event to show Frame2 (AdFrame1)
I tried Public Shared Sub, but I get this error: "Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class"
Code in MainWindow.vb:
Private Sub MainWindow2_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseUp
AdClick()
End Sub
Public Sub AdClick()
Try
clicks += 1
If clicks >= 10 Then
'After 5 seconds Adframe CloseLink and TextBlock1 will hide.
AdFrame1.Visibility = Windows.Visibility.Visible
CloseMainButton.Visibility = Windows.Visibility.Visible
InitializeComponent()
dpTimer = New DispatcherTimer
dpTimer.Interval = TimeSpan.FromMilliseconds(10000)
AddHandler dpTimer.Tick, AddressOf TickMe
dpTimer.Start()
clicks = 0
End If
Catch ex As Exception
MessageBox.Show("Oops! Error X0123A1. Please contact us with error ASAP!", "Error!", MessageBoxButton.OK)
End Try
End Sub
'After 10 sesonds auto close
Private Sub TickMe()
AdFrame1.Visibility = Windows.Visibility.Hidden
End Sub
Code Page1.vb
Private Sub Page1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseUp
AdClick() (inaccessible due to protection)
End Sub
So how would share AdClick() with Page1