22-03-14, 03:25 AM
كود :
If al.Text.Trim.Replace(" ", "") = "" Then Exit Sub
Dim thnote As New Thread(AddressOf tellnote)
Button1.Enabled = False
thnote.Start()
Sub tellnote()
Try
For Each itm In ListBox1.SelectedItems
Dim cm As New SqlCommand("insert into notes (mto,note) values(@mto,@note)", con)
cm.Parameters.AddWithValue("@mto", itm)
cm.Parameters.AddWithValue("@note", al.Text)
If con.State = ConnectionState.Closed Then
con.Open()
End If
cm.ExecuteNonQuery()
MsgBox("تم تنبيه الجميع", MsgBoxStyle.Information, "")
Next
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical, "")
End Try
Button1.Enabled = True
End Sub