VB的text在输入时,例如输入1000,显示成“1,000”

解决方案 »

  1.   

    Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
     Dim a As String, b
     b = Text1
     a = Format(b, "#,###")
     Text1 = a
     Text1.SelStart = Len(a)
    End Sub
      

  2.   

    Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
     Dim a As String, b
     b = Text1
     a = Format(b, "#,###")
     Text1 = a
     Text1.SelStart = Len(a)
    End Sub
      

  3.   

    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    Text1.Text=format(text1.text,"#,###"
    End Sub
      

  4.   

    text1.text=format(text1.text,"standard")
      

  5.   

    Private Sub Text1_Change()
    Text1.Text = Format(Text1.Text, "#,###")
    End Sub