
Public Class Form1
Dim constIntLength As Integer = 9
Dim varStringReadContent As String = ""
Private Sub oneRead_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles oneRead.TextChanged
If oneRead.Text.ToString <> "" Then
If oneRead.Text.ToString.Length <> constIntLength Then
MsgBox("读入长度不正确")
Else
varStringReadContent = oneRead.Text.ToString & "@" & varStringReadContent
totalRead.Text = Replace(varStringReadContent, "@", vbCrLf)
oneRead.Clear()
End If
End If
End Sub
End Class

本文介绍了一个使用VB.NET编写的简单示例程序,该程序用于验证文本框中输入的内容长度是否符合预设的标准长度。如果输入的文本长度不符合要求,则会弹出消息提示错误;若长度正确,则将文本内容按特定格式保存并显示。

被折叠的 条评论
为什么被折叠?



