VB中各个控件默认的text属性是什么数据类型的?string?integer?long?
3个回答
展开全部
在窗体内加入控件text1,然后复制下面代码,运行即可(此功能不太完善,供参考):
Option Explicit
Private Sub Form_Load()
Text1.Text = " - - : : " '初始化格式
End Sub
Private Sub Text1_Change()
Select Case Text1.SelStart
Case 4, 7, 10, 13, 16 '位置控制
Text1.SelStart = Text1.SelStart + 1
End Select
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim i As Long
With Text1
If IsNumeric(Chr(KeyAscii)) = False Then KeyAscii = 0: Exit Sub '非数字退出
i = .SelStart
If i = 19 Then '防止数字输入超出范围
KeyAscii = 0
Exit Sub
End If
.Text = Left(.Text, i) & Mid(.Text, i + 2)
.SelStart = i
End With
End Sub
Option Explicit
Private Sub Form_Load()
Text1.Text = " - - : : " '初始化格式
End Sub
Private Sub Text1_Change()
Select Case Text1.SelStart
Case 4, 7, 10, 13, 16 '位置控制
Text1.SelStart = Text1.SelStart + 1
End Select
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim i As Long
With Text1
If IsNumeric(Chr(KeyAscii)) = False Then KeyAscii = 0: Exit Sub '非数字退出
i = .SelStart
If i = 19 Then '防止数字输入超出范围
KeyAscii = 0
Exit Sub
End If
.Text = Left(.Text, i) & Mid(.Text, i + 2)
.SelStart = i
End With
End Sub
追问
复制粘贴的垃圾
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
一般是string默认的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询