OK i have wrote code that is supposed to open and close CD tray the code works but when i tried to make the code all i one button that's where i got confused. here's the codebasically what i wanted to do was make one button open it then when clicked to would close but i also wanted the text on the button to change along with it. so when clicked the first time the button would say open then when clicked again it would say close. any idea how i could do this? thanks in advance for any help.Code:Public Class Form1 Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _ (ByVal lpCommandString As String, ByVal lpReturnString As String, _ ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim retval As Long If retval = mciSendString("set CDAudio door open", "", 0, 0) Then Else : retval = mciSendString("set CDAudio door closed", "", 0, 0) End If End Sub End Class




Reply With Quote