<!-- /* Font Definitions */ @font-face {font-family:"MS 明朝"; panose-1:2 2 6 9 4 2 5 8 3 4; mso-font-alt:"MS Mincho"; mso-font-charset:128; mso-generic-font-family:roman; mso-font-pitch:fixed; mso-font-signature:-1610612033 1757936891 16 0 131231 0;} @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:宋体; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:Century; panose-1:2 4 6 3 5 7 5 2 3 3; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:3 0 0 0 1 0;} @font-face {font-family:"/@MS 明朝"; panose-1:2 2 6 9 4 2 5 8 3 4; mso-font-charset:128; mso-generic-font-family:roman; mso-font-pitch:fixed; mso-font-signature:-1610612033 1757936891 16 0 131231 0;} @font-face {font-family:"/@SimSun"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:NSimSun; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@NSimSun"; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0mm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:Century; mso-fareast-font-family:"MS 明朝"; mso-bidi-font-family:"Times New Roman"; mso-font-kerning:1.0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:595.3pt 841.9pt; margin:99.25pt 30.0mm 30.0mm 30.0mm; mso-header-margin:42.55pt; mso-footer-margin:49.6pt; mso-paper-source:0; layout-grid:18.0pt;} div.Section1 {page:Section1;} -->
1) Grid 限定某列只能输入数字可在 ValidateEdit 事件中增加如下代码,效果是清空编辑的单元格内容,并且光标停留在原单元格,如想增加提示可在代码中增加 MsgBox 函数
Private Sub AxVSFlexGrid1_ValidateEdit ( ByVal sender As System .Object, ByVal e As AxVSFlex7N . _IVSFlexGridEvents_ValidateEditEvent ) Handles AxVSFlexGrid1 . ValidateEdit
If Not IsNumeric ( AxVSFlexGrid1 . EditText ) Then
‘ Msgbox( “ InPut Legal Number Please! ” )
e . cancel = True
End If
End Sub
2) VB 中使用正则表达式: Imports System.Text.RegularExpressions
例子:
Public Shared Function CheckData ( ByRef strSource As String ) As Boolean
Dim strPattern As String = "^(([1-9]/d*|0)(/./d+)?)$"
If Regex . IsMatch ( strSource , strPattern ) Then
Return True
Else
Return False
End If
End Function
3 ) i++ 与 ++i 的实现
Public Class CMath
Public Shared Function PPInt ( ByRef intS As Integer ) As Integer
Dim intRtn As Integer
intS += 1
intRtn = intS
Return intRtn
End Function
Public Shared Function IntPP ( ByRef intS As Integer ) As Integer
Dim intRtn As Integer
intRtn = intS
intS += 1
Return intRtn
End Function
End Class
4 ) VB 中类的继承
Public Class CErrorProvider
Inherits ErrorProvider
Private Const intLeft As Integer = 10
Public Overloads Sub SetError ( ByRef control As System . Windows . Forms . Control , ByRef value As String )
SetIconLoc ( control )
MyBase . SetError ( control , value )
End Sub
Private Sub SetIconLoc ( ByRef control As System . Windows . Forms . Control )
If control . Width + control . Location . X + intLeft + MyBase . Icon . Width < control . Parent . Width Then
MyBase . SetIconAlignment ( control , ErrorIconAlignment . MiddleRight )
Else
MyBase . SetIconAlignment ( control , ErrorIconAlignment . MiddleLeft )
End If
End Sub
End Class
5 ) VS2005 设置( VB 、 VC 工程设置互换)
在 Tools ->Import and Export Settings 中 选择 Reset All Settings 下一步,随便选一个,下一步,选择对应的语言的工程设置即可。