给个建议,不过没有具体试过,不知道可否? 既然你的Text是绑定数据的。 那么在Text_Change能否添加Format的代码呢? 当数据由数据源传送到控件的时候,会激发Change事件,在显示之前做一次Format。Private Sub Form_Load() Text1.Text = "22" End SubPrivate Sub Text1_Change() Text1.Text = Format(Text1.Text, "0000") End Sub类似上面的代码,Text框中显示的就是0022
2、怎么设置啊,grid 中的数据是绑定来的
Format(5459.4, "##,##0.00") -------> 5,459.40
MSFlexGrid1.TextMatrix(0, 1) = "abc"
MSFlexGrid1.ColAlignment(1) = flexAlignRightCenter
MSFlexGrid1.TextMatrix(1, 1) = "abc"
既然你的Text是绑定数据的。
那么在Text_Change能否添加Format的代码呢? 当数据由数据源传送到控件的时候,会激发Change事件,在显示之前做一次Format。Private Sub Form_Load()
Text1.Text = "22"
End SubPrivate Sub Text1_Change()
Text1.Text = Format(Text1.Text, "0000")
End Sub类似上面的代码,Text框中显示的就是0022