-1
我需要在按下回車鍵時停止「叮」聲,但我用它發送消息。這裏是我的代碼:如何在按下ENTER鍵的同時停止「叮」聲
Private Sub textbox2_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) _
Handles TextBox2.KeyDown
If e.KeyCode = Keys.Enter Then
TextBox3.ReadOnly = True
If TextBox2.Text = ("") Then
Else
Dim PostData = "token=" & TextBox1.Text & "&msg=" & TextBox3.Text & ": " & TextBox2.Text
Dim request As WebRequest = WebRequest.Create("http://url.com/msg.php")
request.Method = "POST"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(PostData)
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
reader.Close()
dataStream.Close()
response.Close()
TextBox2.Clear()
End If
End If
End Sub
我使用的是另一種聲音,當一個文本框改爲通知,但這是TextBox2中發送消息,當它使用它進入這個「叮」的劇本和其他聲音一起發送。
這個代碼真的和聲音有什麼關係嗎?如果聲音是Windows聲音之一,那麼代碼有點不相關。請參閱http://stackoverflow.com/help/mcve –