VB中 5个TEST 控件 在第1个输入例如: 12345 那么第一个只显示1 第2个中只显示2 依次类推 请问如何编写?
解决方案 »
- 如何使用vb改变图形的大小呢。
- 请教一webbrowser的一个方法
- 对项目经理,还能继续容忍下去吗?
- 如何控制excel表中每列的宽度以及字体
- 软件有了进展,高兴。。。散分。。。
- 我想做一个控件,希望有adodc一样的属性页,不知道能否直接调用adodc的属性页,请高手指教!
- 水晶报表中文版下载!!需要的赶快来下!
- 请教一个VBA中读取文件的问题!
- 真的没有办法改变另一个程序的工具栏按钮文字吗? 我已经试了三种以上的办法,都失败了......
- 怎样能使我的程序里的日志记录里的日期与时间不随系统日期与时间的改变而改变?
- 怎样实现利用vb导出excel.xsl时,自动利用系统时间给文件命名???
- WORD表格问题
for i=0 to 4
text(i).text=mid(str,i,1)
next
在 Private Sub Text1_Change(Index As Integer)下面如何编写
Select Case Index
Case 0
If Text1(0).Text = "12345" Then
For I = 0 To 4
Text1(I).Text = I + 1
Next
End If
End Select
End Sub
Text1(I).Text = mid(TEXT1(0).TEXT,i,1)
Dim a As TextBox
Dim j As Integer
Dim i As Integer
Dim m As String
i = Len(Text1.Text)
m = Text1.Text
For j = 1 To i
Set a = Form1.Controls.Add("VB.TextBox", "TextBox" & j)
a.Visible = True
a.Move j * 500, j * 400, 1000, 300
a.Text = Mid(m, j, 1)
Next
End Sub
不知道符不符合你的要求,不过大体意思应该是这样子的吧。
Dim i As Integer
For i = 0 To 4
Text1(i).MaxLength = 1
Next i
End SubPrivate Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If (Index < 4) Then
Text1(Index + 1).SetFocus
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index) = ""
End Sub如果一定要 Text1 至 Text5:Private Sub Form_Load()
Text1.MaxLength = 1
Text2.MaxLength = 1
Text3.MaxLength = 1
Text4.MaxLength = 1
Text5.MaxLength = 1
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
Text2.SetFocus
End Sub Private Sub Text2_KeyPress(KeyAscii As Integer)
Text3.SetFocus
End Sub Private Sub Text3_KeyPress(KeyAscii As Integer)
Text4.SetFocus
End Sub Private Sub Text4_KeyPress(KeyAscii As Integer)
Text5.SetFocus
End Sub Private Sub Text1_GotFocus()
Text1 = ""
End SubPrivate Sub Text2_GotFocus()
Text2 = ""
End SubPrivate Sub Text3_GotFocus()
Text3 = ""
End SubPrivate Sub Text4_GotFocus()
Text4 = ""
End SubPrivate Sub Text5_GotFocus()
Text5 = ""
End Sub