2020年8月5日 星期三

vb.net 將textbox用成 html的 placeholder [Use Textbox hint]

1
2
3
4
5
6
7
    Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
        If TextBox1.Text = "網址如 https://long-ay.blogspot.com/" Then
            TextBox1.Text = ""
            TextBox1.ForeColor = Color.Black
            TextBox1.TextAlign = HorizontalAlignment.Left
        End If
    End Sub





1
2
3
4
5
6
7
    Private Sub TextBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Leave
        If TextBox1.Text = "" Then
            TextBox1.Text = "網址如 https://long-ay.blogspot.com/"
            TextBox1.ForeColor = Color.Silver
            TextBox1.TextAlign = HorizontalAlignment.Right
        End If
    End Sub

沒有留言:

張貼留言