Monday, February 14, 2011

Assignment Three - Question Two

Form with 4 buttons
1 - enable/disable textbox
2 - change background color in textbox between two colors
3 - Put in and remove text in textbox
4 - Change border style between fixed 3d and none

 Public Class Form1
  
   Private Sub btnEnable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnable.Click
  
     If txtBox.Enabled = True Then
  
       txtBox.Enabled = False
  
     ElseIf txtBox.Enabled = False Then
  
       txtBox.Enabled = True
  
     End If
  
   End Sub
  
   Private Sub btnBackground_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBackground.Click
  
     If txtBox.BackColor = Color.White Then
  
       txtBox.BackColor = Color.Red
  
     ElseIf txtBox.BackColor = Color.Red Then
  
       txtBox.BackColor = Color.White
  
     End If
  
   End Sub
  
   Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHide.Click
  
     If txtBox.Text = "Now You See Me" Then
  
       txtBox.Text = ""
  
     ElseIf txtBox.Text = "" Then
  
       txtBox.Text = "Now You See Me"
  
     End If
  
   End Sub
  
   Private Sub btnBoarder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBoarder.Click
  
     If txtBox.BorderStyle = BorderStyle.Fixed3D Then
  
       txtBox.BorderStyle = BorderStyle.None
  
     ElseIf txtBox.BorderStyle = BorderStyle.None Then
  
       txtBox.BorderStyle = BorderStyle.Fixed3D
  
     End If
  
   End Sub
  
 End Class  

No comments:

Post a Comment