合法编号的组成是:前2个字符是大写英文字母,第3个字符是"-",后面是数字字符(至少1个)。下面程序可实现此功能,请填空。 Private Sub Text1_LostFocus() Dim k%.n%。 n=Len( (13) ) For k=1 To IIf(n>3,n,4) c=Mid(Text1.Text,k,1) Select Case k Case 1.2 If c<"A" Or c>"Z" "Then MsgBox("第" &k&"个字符必须大写字母!") SetPosition k:Exit For End If Case 3 If c<>"_ "Then MsgBox"第"&k&"个字符必须是字符""-""" SetPosition k:Exit For End If Case Else If c<"0" Or c>"9" Then MsgBox("第"&k&"个字符必须是数字!") SetPosition k:Exit For End If End Select Next k End Sub Private Sub SetPosition(pos As Integer) Text1.SelStart=pos-1 Text1.SelLength= (14) Text1. (15) End Sub