Text1.Text=Left$(Text1.Text,Len(Text1.Text) - 1)
赋值给一个变量:dim i as long '定义i为一个长整数 Private sub text1_change()'如果TEXT1的数值改变,那么把i的值改为text1的只 i=text1.text end sub 个输入框的值分别相加:(这里就假如有5个)Private siub command1_click()Msgbox "得出的和:" & text1.text + text2.text + text...
If TypeName(tt) = "TextBox" Then kk = Replace(tt.Text, vbCrLf, "#_#")If VarType(CallByName(Me, tt.Name, VbGet)) = vbObject Then Print #1, tt.Name & "^_^" & tt.Index & "^_^" & kk Else Print #1, tt.Name & "^_^^_^" & kk End If End If Next Close #1...
VB6.0可以使用TextBok控件或RichTextBox控件实现将读入文本文件显示于控件中。TextBox 控件有时也称作编辑字段或者编辑控件,显示设计时输入的用户输入的、或运行时在代码中赋予控件的信息。为了在 TextBox 控件中显示多行文本,要将 MultiLine 属性设置为 True。如果多行 TextBox 没有水平滚动条,那么...
Private Sub command1_click()Dim npos1 As Integer, npos2 As Integer npos1 = InStr(Text5, "AX")Text1 = Left(Text5, npos1 - 1)npos1 = npos1 + Len("AX")npos2 = InStr(npos1, Text5, "X")Text2 = Mid(Text5, npos1, npos2 - npos1)Text2 = CInt(Text2) / 1000 ...
Text1.Text = v End If Text1.SelStart = Len(Text1.Text)End If End Sub Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)If KeyCode = 8 Then If Right(Text1.Text, 1) = "-" Then cl = True End If End If Text1.SelStart = Len(Text1.Text)End Sub Privat...
在“转换”按钮上双击,输入代码:Dim a As String, b As Integer a = text1.Text b = CInt(a)If b <= 21 Then text2.Text = (b - 1) \ 3 + 1 Else text2.Text = (b - 22) \ 4 + 8 End If 就可以了。已测试通过。
VB6.0可设置文本框的PasswordChar 属性为*号字符,就能达到目的。PasswordChar 属性,返回或设置一个值,该值指示所键入的字符或占位符在 TextBox 控件中是否要显示出来;返回或设置用作占位符。PasswordChar 属性示例 本例说明 PasswordChar 属性是如何影响 TextBox 控件显示文本的方法的。要试用此例,先将...
字符数可以用Text1.MaxLength来设置 比如设置成五 那么文本框只能输入5个字符 多了就输入不上去了 光输入数字的话可以这样 设置Text1.Text="" 代码如下:Private Sub Text1_KeyPress(KeyAscii As Integer)If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 End Sub 光输入字母的话可以这样 ...
2、IsNumeric(Text1.Text)不能完全符合设置,比如你输入12,然后按左箭头将光标移动1和2中间再输入字母E或D,是不会提示的,因为VB中默认1E2之类是数值的(科学计数法,1E2=100)。另一个方法,用KeyPress事件,限制不输入除数字外的其他字符:Private Sub Text1_KeyPress(KeyAscii As Integer)If ...