I solve my problema using this codes.
Actually, I managed to solve it in two ways. There goes the first
enter image description here
Code:
Public Class Form1
Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte,
ByVal bScan As Byte,
ByVal dwFlags As Byte,
ByVal dwExtraInfo As Byte)
Private Const VK_RETURN As Byte = &HD
Private Const KEYEVENTF_KEYDOWN As Byte = &H0
Private Const KEYEVENTF_KEYUP As Byte = &H2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim t As New Threading.Thread(AddressOf closeMsgbox)
t.Start(3) '3 second delay
MsgBox("message")
End Sub
Private Sub closeMsgbox(ByVal delay As Object)
Threading.Thread.Sleep(CInt(delay) * 1000)
AppActivate(Me.Text)
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYDOWN, 0)
keybd_event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0)
End Sub
End Class
I solved my problem with this ideia too , based on the user idea F0r3v3r-A-N00b, I created a new form window, like a messagebox, I placed an x seconds timer with my SQL write event + the information sending code.
ty F0r3v3r-A-N00b for idea !
PART - 1 , see for details
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
entrada_log_mensagem.Show()
End Sub
PART - 2 , see for timer details
Private Sub entrada_log_mensagem_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PRINCIPAL.Show()
Timer.Start()
End Sub
Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick
Me.Close()
End Sub
I hope I have helped the community with this code as well, because I went through a problem and could not solve it. Ahmed Abdelhameed's suggestion did not really work, but I thank him for his attention.
Anyway now everything is working as it should
Thank you again to everyone who could give their time for this.