1.
Public Class Form1
Private Sub btnMove_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnMove.MouseHover
Dim P1 As New Point(5, 239)
Dim P2 As New Point(39, 215)
If btnMove.Location = P1 Then
btnMove.Location = P2
ElseIf btnExit.Location = P2 Then
btnMove.Location = P1
Else
btnMove.Location = P1
End If
'btnMove.Location = New Point(39, 151)
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
2.
Public Class Form1
Private Sub btnColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnColor.Click
'to change the color back and forth i just used a if statement so that if i click the button and it is Black then it will
'change to White but if it is not already Black then it would change to black
If txtTest.BackColor = Color.Black Then
txtTest.BackColor = Color.White
Else
txtTest.BackColor = Color.Black
End If
End Sub
Private Sub btnText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnText.Click
'I did this one the same as the color one the only change i made was that i am using text now so the second one is just a
'empty string
If txtTest.Text = "hello" Then
txtTest.Text = " "
Else
txtTest.Text = "hello"
End If
End Sub
Private Sub btnBorder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBorder.Click
'This one it the same as the two above.
If txtTest.BorderStyle = BorderStyle.Fixed3D Then
txtTest.BorderStyle = BorderStyle.None
Else
txtTest.BorderStyle = BorderStyle.Fixed3D
End If
End Sub
Private Sub btnDisable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisable.Click
'This one is also the same
If txtTest.Enabled = False Then
txtTest.Enabled = True
Else
txtTest.Enabled = False
End If
End Sub
End Class
3.
Public Class Form1
Dim lbl1, lbl2, lbl3 As New Label
Dim WithEvents txt1, txt2, txt3 As New TextBox
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
lbl1.AutoSize = True
lbl1.Text = "Hi"
Me.Controls.Add(lbl1)
lbl1.Location = New Point(8, 163)
lbl2.AutoSize = True
lbl2.Text = "Good"
Me.Controls.Add(lbl2)
lbl2.Location = New Point(5, 236)
lbl3.AutoSize = True
lbl3.Text = "Morning"
Me.Controls.Add(lbl3)
lbl3.Location = New Point(1, 6)
txt1.Location = New Point(65, 6)
Me.Controls.Add(txt1)
txt1.Name = "txt1"
txt2.Location = New Point(125, 240)
Me.Controls.Add(txt2)
txt2.Name = "txt2"
txt3.Location = New Point(54, 166)
Me.Controls.Add(txt3)
txt3.Name = "txt3"
End Sub
Private Sub txthightlight1() Handles txt1.MouseEnter
txt1.BackColor = Color.Blue
End Sub
Private Sub txthightlight1B() Handles txt1.MouseLeave
txt1.BackColor = Color.White
End Sub
Private Sub txthightlight2() Handles txt2.MouseEnter
txt2.BackColor = Color.Black
End Sub
Private Sub txthightlight2B() Handles txt2.MouseLeave
txt2.BackColor = Color.White
End Sub
Private Sub txthightlight3() Handles txt3.MouseEnter
txt3.BackColor = Color.Red
End Sub
Private Sub txthightlight3B() Handles txt3.MouseLeave
txt3.BackColor = Color.White
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class