I have installed Avast Antivirus Free edition and only have limited tools being utilized. No Firewall I have a once a week scan set. When I Start the computer and do not use any apps and do a Shutdown the system close down as normal. Now if I Start the computer and use any one of the apps I have written in VB.Net that use a SQLite DB and it opens a YouTube webpage and watch the video. I close out of the webpage AND close the VB.Net application with a press of the ESC button with this code
If Asc(e.KeyChar) = 27 Then
Application.Exit()
End If
Avast gives me a message that I need to close a program running in the background.It does not show the name of the program. This can take 4 min to 30 min no idea what causes the different times. I think it depends on how many web sites or the number of apps that I have written that were opened. I have Visual Studio set to not check for updates in the application & I have disable checking for updates in Task Scheduler for VS 2019 I have Firefox and Google Chrome and DuckDuckGo installed. I unchecked "Use background service to install updates" I have considered using a Private Sub that uses cmdClose and cmdKill but not sure this is a FIX! Any suggestion are appreciated Thanks
REQUESTED EDIT Here is the code I use to open the Web Page
Private Sub dgvLinks_CellClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvLinks.CellClick
selRow = e.RowIndex
If e.RowIndex = -1 Then
gvalertType = "4"
frmAlert.ShowDialog()
Exit Sub
End If
Dim row As DataGridViewRow = Me.dgvLinks.Rows(e.RowIndex)
If row.Cells(2).Value Is Nothing Then
gvalertType = "5"
frmAlert.ShowDialog()
Return
Exit Sub
ElseIf gvTxType = "View" Then
webPAGE = row.Cells(2).Value.ToString()
siteID = CInt(row.Cells(0).Value.ToString())
UpdateSiteData()
'KEEP CODE BELOW incase Google stops Firefox from working
'=========================================================
''Process.Start("chrome.exe", "-maximized --incognito " & webPAGE)
Process.Start("Chrome.exe", webPAGE)
'Process.Start("firefox.exe", webPAGE)
''Process.Start("firefox.exe", " -private-window " & webPAGE)
ElseIf gvTxType = "Delete" Or gvTxType = "Update" Then
gvID = CInt(row.Cells(0).Value)
gvSiteName = row.Cells(1).Value.ToString
gvSiteURL = row.Cells(2).Value.ToString
frmADE.Show()
Close()
End If
End Sub
ON Form Start I open & close the application Here is the code to Open the Database so when I close the DB
Private Sub frmStart_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If My.Computer.FileSystem.FileExists(gv_dbName) Then
btnCreateDB.Visible = False
btnVLink.Visible = True
cbType.Visible = True
lblSiteType.Visible = True
FillComboBox()
Me.Width = 700
Me.Height = 350
gvSLT = ""
pbYouTube.Image = My.Resources.ytbt
Me.Refresh()
Else
Me.Width = 265 'Was 700
Me.Height = 190
Me.Refresh()
btnCreateDB.Visible = True
btnVLink.Visible = False
End If
End Sub
SO when I use Application.Exit() use code like this ?
Public Class DatabaseManager
Private Shared connections As New List(Of SqlConnection)
Public Shared Sub AddConnection(connection As SqlConnection)
connections.Add(connection)
End Sub
Public Shared Sub CloseAllConnections()
For Each connection As SqlConnection In connections
If connection.State = ConnectionState.Open Then
connection.Close()
End If
connection.Dispose()
Next
connections.Clear()
End Sub
End Class