Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click Dim str As String str = InputBox("123") If Len(str) > 0 Then '有输入并确定 MessageBox.Show(str) Else '无输入或取消 MessageBox.Show("no") End If End Sub End Class原文链接:https://www.f2er.com/vb/258503.html