HELLO,WORLD!

按钮一点,判断txt是否为空,不是则在lbl显示 hello world!
加载form的时候,跳出输入对话框,不空择在Lbl显示 hello,world!

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Len(TextBox1.Text) <> 0 Then
            Label1.Text = "Hello," + TextBox1.Text + "!"
        End If
    End Sub

    Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
        TextBox1.Text = ""
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim name As String
        name = InputBox("Input ur name!", "Input name", , , )
        If name <> "" Then
            Label1.Text = "Hello," + name + "。"
        End If
    End Sub
End Class

posted on 2006-03-31 16:37  zljini  阅读(1130)  评论(0编辑  收藏  举报