Hi, I'm searching for a way that let run a event without need, that specific form to be open, and also save thing.
I explain better, the performclick will only fire if that specific form it's open, I'm searching a way to do this on background.
This is the code of where performclick will fire (thanks to a timer)
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
Dim value As Integer = maxVal
If Not IsNumeric(Label10.Text) Then
Label10.Text = maxVal.ToString
End If
Integer.TryParse(Label10.Text, value)
If value >= 1 And value <= maxVal Then
value -= 1
Label10.Text = value.ToString
Else
If value <= 0 Then
Form11.Button5.PerformClick()
Timer1.Stop()
Label10.Text = maxVal.ToString
End If
End If
Catch ex As Exception
End Try
End Sub
This is the form11's button_5 code
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Try
For i As Integer = 0 To ComboBox3.Items.Count - 1
ComboBox2.SelectedIndex = i
Dim d As DateTime = DateTime.Now
Dim parsedate As DateTime = ComboBox2.Items(i).ToString
Dim d2 As DateTime = DateTime.ParseExact(parsedate, "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture)
Dim ts As New TimeSpan((d - d2).Ticks)
Dim dysdiff As Integer = ts.TotalDays
Dim cbNum As Integer = 365 - dysdiff
ComboBox3.Items(i) = cbNum.ToString
Dim lstname As String
lstname = ListBox1.Items(i).ToString()
If cbNum <= 10 AndAlso cbNum >= 1 Then
NotifyIcon1.ShowBalloonTip(3000, "test", lstname & " have " & cbNum & " days left before will get delete", ToolTipIcon.None)
End If
Next
Catch ex As Exception
End Try
End Sub