Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Thủ thuật Visual Basic hay nhất
Nội dung xem thử
Mô tả chi tiết
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 1
Thủ thuật Visual Basic 6.0
Thủ Thuật:
Nhận biết kiểu của một chuỗi bất kỳ
Giới Thiệu:
Khi bạn kiểm tra kiểu của một chuỗi, bạn có thể sử dụng một số hàm nhỏ như IsDouble, IsText,
IsSpace... Thủ thuật này hướng dẫn bạn tạo một hàm nhận biết kiểu của một chuỗi, hàm này
chứa những hàm nhỏ như trên và có thể ñược mở rộng ñể biết những kiểu chuỗi khác như
IsShortDate, IsLongDate, IsUpperCaseAlphabet... Hiện tại hàm này biết 11 kiểu chuỗi khác nhau.
Ví Dụ:
'Module code:
Public Enum StrCodes
strALPHABETIC = 1
strNUMERIC = 2
strWHOLENUM = 3
strALPHANUMERIC = 4
strALPHASPACE = 5
strALPHANUMSPACE = 6
strALLCHARS = 7
strSPECIALCHAR = 8
strEMPTYSTRING = 9
strNULLSTRING = 10
strOVERFLOWNUM = 11
End Enum
Public Function EvalString(ByVal Str As String) As StrCodes
Dim ANum As Double
On Error GoTo NumError
If IsNull(Str) Then EvalString = strNULLSTRING: Exit Function
If Str = " Then EvalString = strEMPTYSTRING: Exit Function
ANum = Int(Str)
If InStr(1, Str, ".", vbTextCompare) > 0 Or InStr(1, Str, "E",
vbTextCompare) > 0 Then
EvalString = strNUMERIC
Exit Function
Else
EvalString = strWHOLENUM
Exit Function
End If
NotNumeric:
Dim pix As Integer
Dim piAsc As Integer
Dim pbAlphaFlag As Boolean
Dim pbNumFlag As Boolean
Dim pbSpaceFlag As Boolean
Dim pbMiscFlag As Boolean
For pix = 1 To Len(Str)
piAsc = Asc(Mid$(Str, pix, 1))
If (piAsc >= 65 And piAsc <= 90) Or (piAsc >= 97 And piAsc <= 122)
Then
pbAlphaFlag = True
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 2
ElseIf (piAsc >= 48 And piAsc <= 57) Then
pbNumFlag = True
ElseIf (piAsc = 32) Then
pbSpaceFlag = True
Else
pbMiscFlag = True
End If
If pbAlphaFlag And pbNumFlag And pbMiscFlag Then
EvalString = strALLCHARS
Exit Function
End If
Next pix
If pbAlphaFlag And Not pbNumFlag And Not pbSpaceFlag And Not
pbMiscFlag Then
EvalString = strALPHABETIC
Exit Function
ElseIf pbAlphaFlag And pbNumFlag And Not pbSpaceFlag And Not
pbMiscFlag Then
EvalString = strALPHANUMERIC
Exit Function
ElseIf pbAlphaFlag And Not pbNumFlag And pbSpaceFlag And Not
pbMiscFlag Then
EvalString = strALPHASPACE
Exit Function
ElseIf pbAlphaFlag And pbNumFlag And pbSpaceFlag And Not pbMiscFlag
Then
EvalString = strALPHANUMSPACE
Exit Function
ElseIf Not pbAlphaFlag And Not pbNumFlag And Not pbSpaceFlag And
pbMiscFlag Then
EvalString = strALLCHARS
End If
Exit Function
NumError:
If Err.Number = 13 Then
Resume NotNumeric
ElseIf Err.Number = 6 Then
EvalString = strOVERFLOWNUM
Else
MsgBox Err.Number & " " & Err.Description, vbExclamation, "String
Eval Error"
End If
End Function
ðể kiểm tra kiểu của một chuỗi bạn sử dụng ñoạn code sau:
Dim VarType As Integer
Dim myVar As String
myVar = "1234"
VarType = EvalString(myVar)
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 3
Thủ Thuật:
Kiểm tra ñịa chỉ Email
Giới Thiệu:
Khi thiết kế chương trình bạn ñòi hỏi người dùng phải nhập ñịa chỉ email ñúng ñịnh dạng có tên
email kèm theo @ và cuối cùng ñuôi email do nhà cung cấp quy ñịnh, ví dụ như ñịa chỉ email có
ñịnh dạng [email protected]. Với ñịa chỉ như thế này bạn bắt buộc người dùng ñiền
ñầy ñủ nhưng ñâu có phải ai cũng "chăm chỉ" ñiền ñầy ñủ như vậy, chỉ còn cách là dùng luật
"trên bảo dưới phải nghe", muốn lười cũng không ñược. Chỉ cần ñoạn mã ñơn giản sau:
Ví Dụ:
Public Function kiemtraemail(EmailAddress As String) As Boolean
kiemtraemail = EmailAddress Like "*@[A-Z,a-z,0-9]*.*"
End Function
Trong Form1 bạn thêm vào ñó 1 textbox với thuộc tính Name là EmailText
dùng ñể nhập ñịa chỉ email và 1 command1 ñể kiểm tra tính hợp lệ của
ñịa chỉ email khi người dùng ấn vào:
Private Sub Command1_Click()
If (kiemtraemail(EmailText.Text) = False) Then ‘ Nếu ñịa chỉ email
không ñúng
Beep ‘ Kêu 1 tiếng bíp cho người dùng sợ
MsgBox "chu y: Dia chi email khong hop le", vbOKOnly, "Thong
bao"
Else
MsgBox "Dia chi email da hop le", vbOKOnly, "Thong bao"
End If
End Sub
Thủ Thuật:
Lấy tham số truyền từ dòng lệnh
Giới Thiệu:
VB cung cấp cho ta hàm Command() hay Command$(). Hàm này trả về một String mà bạn
truyền vào từ dòng lệnh khi gọi chương trình.
Ví Dụ:
Type StrPram
SoLuong As Integer
PramIndex As Variant
End Type
Function GetCmdLine() As StrPram
Dim CmdLine, stmp
CmdLine = Command()
If Len(CmdLine) = 0 Then Exit Function
CmdLine = Replace(CmdLine, vbTab, " ")
CmdLine = Replace(CmdLine, ";", " ")
stmp = CmdLine
Do
stmp = Mid(stmp, I + 1)
I = InStr(stmp, " ")
GetCmdLine.SoLuong = GetCmdLine.SoLuong + 1
Loop Until I = 0
If GetCmdLine.SoLuong = 0 Then Exit Function
GetCmdLine.PramIndex = Split(CmdLine, " ")
End Function
'Giả sử tên chương trình là PT37.EXE
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 4
' PT37.EXE c1 c2;c3;c4
Private Sub Form_Load()
If GetCmdLine.SoLuong > 0 Then
For i = 0 To GetCmdLine.SoLuong -1
MsgBox GetCmdLine.PramIndex(i)
Next
End If
End Sub
Thủ Thuật:
Tạo dòng chữ chạy liên tục
Giới Thiệu:
Thật ra chuyện này cũng dễ hiểu, bạn chỉ cần cắt chữ ở ñầu ñoạn văn bản và gắn nó vào cuối
ñoạn văn bản, làm liên tục như vậy sẽ tạo cho người dùng có cảm giác là dòng chữ ñang chạy.
Ví Dụ:
Bạn hãy mở 1 form mới, trên ñó tạo 1 textbox (Text1), gán 1 dòng văn
bản vào thuộc tính text của textbox, tạo 1 Timer (Timer1).
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Và Timer sẽ xử lý các lệnh theo yêu cầu của bạn mỗi khi nó phát sinh 1
sự kiện thời gian.
Private Sub Timer1_Timer()
Dim x As String
Dim y As String
'gán x = 1 ký tự ñầu dòng văn bản
x = Left(Text1.Text, 1)
'gán y là phần còn lại
y = Right(Text1.Text, Len(Text1.Text) - 1)
'Hiển thị trở lại TextBox theo thứ tự ngược lại.
Text1.Text = y + x
End Sub
Thủ Thuật:
Xóa bỏ các khoảng trống
Giới Thiệu:
Hàm sau sẽ cắt bớt các khoảng trống dư thừa trong 1 chuỗi
Ví Dụ:
Private Function PreventDuplicateSpaces(Word)
Dim i, WordLength, Character, LastCharacter, NewWord
On Error GoTo ErrorHandler
WordLength = Len(Word)
For i = 1 To WordLength
Character = Mid(Word, i, 1)
If LastCharacter = " " And Character = " " Then
Else
NewWord = NewWord & Character
LastCharacter = Character
End If
Next i
PreventDuplicateSpaces = Trim(NewWord)
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 5
Exit Function
ErrorHandler:
End Function
Thủ Thuật:
Chuyển số thành chữ
Giới Thiệu:
Bạn muốn chuyển ñổi 1 số nào ñó sang dạng chữ như: 12345 thành "Mười hai ngàn ba trăm bốn
mươi lăm". Hãy thử ñoạn code bên dưới xem.
Ví Dụ:
'Mã chuyển một số sang một chuỗi
Public Function NumToText(mVarStr As String) As String
Static Ones(0 To 11) As String, Teens(0 To 9) As String, Tens(0 To 9)
As String
Static Thousands(0 To 4) As String, bInit As Boolean
Dim i As Integer, bAllZeros As Boolean, bShowThousands As Boolean
Dim StrVal As String, StrBuff As String, StrTemp As String
Dim nCol As Integer, nChar As Integer
Dim J&
J = Len(CStr(CLng(mVarStr)))
'Chỉ làm việc cho các số dương
Debug.Assert mVarStr >= 0
If bInit = False Then
'Bắt ñầu tạo mảng
bInit = True
Ones(0) = "Không"
Ones(1) = "Một"
Ones(2) = "Hai"
Ones(3) = "Ba"
Ones(4) = "Bốn"
Ones(5) = "Năm"
Ones(6) = "Sáu"
Ones(7) = "Bảy"
Ones(8) = "Tám"
Ones(9) = "Chín"
Ones(10) = "Mốt"
Ones(11) = "Tư"
Teens(0) = "Mười"
Teens(1) = "Mười Một"
Teens(2) = "Mười Hai"
Teens(3) = "Mười Ba"
Teens(4) = "Mười Bốn"
Teens(5) = "Mười Năm"
Teens(6) = "Mơừi Sáu"
Teens(7) = "Mười Bảy"
Teens(8) = "Mơừi Tám"
Teens(9) = "Mười Chín"
Tens(0) = "
Tens(1) = "Mười"
Tens(2) = "Hai Mươi"
Tens(3) = "Ba Mươi"
Tens(4) = "Bốn Mươi"
Tens(5) = "Năm Mươi"
Tens(6) = "Sáu Mươi"
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 6
Tens(7) = "Bảy Mươi"
Tens(8) = "Tám Mươi"
Tens(9) = "Chín Mươi"
Thousands(0) = "
Thousands(1) = "Nghìn" '
Thousands(2) = "Triệu"
Thousands(3) = "Tỉ"
Thousands(4) = "Nghìn"
End If
'Bẫy lỗi
On Error GoTo Err2TextTrap
'Lấy phần lẻ
'StrBuff = "Và " & Format((mVarStr - CLng(mVarStr)) * 100, "00") &
"/100"
'Chuyển ñịnh dạng dữ liệu vào
StrVal = CStr(CLng(mVarStr))
'Tất cả cả số ñều là Zero
bAllZeros = True
'Làm vòng lặp với chuỗi sau khi chuyển ñịnh dạng
For i = Len(StrVal) To 1 Step -1
'Lấy từng kí số
nChar = Val(Mid$(StrVal, i, 1))
'Tìm số cột cho kí số
nCol = (Len(StrVal) - i) + 1
'Chọn ở hàng ñơn vị 1,10,100
Select Case (nCol Mod 3)
Case 1 'Trường hợp là 1
bShowThousands = True
If i = 1 Then
'Số ñầu tiên
StrTemp = Ones(nChar) & " "
ElseIf Mid$(StrVal, i - 1, 1) = "1" Then
'Các số sau ở trong hàng mười
StrTemp = Teens(nChar) & " "
i = i - 1 'Giữ lại các số có hai con số
ElseIf nChar > 0 Then
'Các số có một con số
StrTemp = Ones(nChar) & " "
Else
bShowThousands = False
If Mid$(StrVal, i - 1, 1) <> "0" Then
bShowThousands = True
ElseIf i > 2 Then
If Mid$(StrVal, i - 2, 1) <> "0" Then bShowThousands
= True
End If
StrTemp = "
End If
If bShowThousands Then
If nCol > 1 Then
StrTemp = StrTemp & Thousands(nCol 3)
If bAllZeros Then
StrTemp = StrTemp & " "
Else
StrTemp = StrTemp & ", "
End If
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 7
End If
bAllZeros = False
End If
StrBuff = StrTemp & StrBuff
Case 2
If nChar > 0 Then
If Mid$(StrVal, i + 1, 1) <> "0" Then
StrBuff = Tens(nChar) & " " & StrBuff
Else
StrBuff = Tens(nChar) & " " & StrBuff
End If
End If
Case 0
If nChar > 0 Then StrBuff = Ones(nChar) & " Trăm " &
StrBuff
End Select
Next i
StrBuff = Trim$(StrBuff)
If ((Right$(StrBuff, 3) = Ones(1))) And (J > 2) Then _
StrBuff = Left$(StrBuff, Len(StrBuff) - 3) & Ones(10)
If ((Right$(StrBuff, 3) = Ones(4))) And (J > 2) Then _
StrBuff = Left$(StrBuff, Len(StrBuff) - 3) & Ones(11)
' If ((Right$(StrBuff, 3) = Ones(4))) Then _
'StrTemp = Left$(StrBuff, Len(StrBuff) - 3) & Ones(11)
StrBuff = UCase$(Left$(StrBuff, 1)) & Mid$(StrBuff, 2)
'StrBuff = " Và " & Format((mVarStr - CLng(mVarStr)) * 100, "00")
& "/100"
If (CDbl(mVarStr) - CLng(mVarStr) > 0) Then StrBuff = StrBuff _
& " ( Và " & Format((mVarStr - CLng(mVarStr)) * 100, "00") &
"/100)"
Err2Text:
NumToText = StrBuff
Exit Function
Err2TextTrap:
StrBuff = "#Error#"
Resume Err2Text
End Function
Thủ Thuật:
Làm cho tên ñường dẫn dài vừa khít với kích thước Label
Giới Thiệu:
Giả sử bạn cần hiển thị 1 ñường dẫn trên một Label. Nhưng nếu tên ñường dẫn quá dài thì có
thể Label không ñủ chỗ ñể hiển thị ñầy ñủ nó. Có 1 cách ñể ñịnh dạng tên ñường dẫn là hiển thị
phần ñầu của ñường dẫn và tên file, bỏ qua những thư mục ở giữa và thay thế chúng bằng dấu
chấm (...). Phương pháp này ñược sử dụng trong nhiều ứng dụng của Microsoft.
Ví Dụ:
Module code:
Option Explicit
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 8
Private Type RECT
Left As Long
top As Long
Right As Long
bottom As Long
End Type
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal
hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As
RECT, ByVal wFormat As Long) As Long
Private Const DT_BOTTOM = &H8&
Private Const DT_CENTER = &H1&
Private Const DT_LEFT = &H0&
Private Const DT_CALCRECT = &H400&
Private Const DT_WORDBREAK = &H10&
Private Const DT_VCENTER = &H4&
Private Const DT_TOP = &H0&
Private Const DT_TABSTOP = &H80&
Private Const DT_SINGLELINE = &H20&
Private Const DT_RIGHT = &H2&
Private Const DT_NOCLIP = &H100&
Private Const DT_INTERNAL = &H1000&
Private Const DT_EXTERNALLEADING = &H200&
Private Const DT_EXPANDTABS = &H40&
Private Const DT_CHARSTREAM = 4&
Private Const DT_NOPREFIX = &H800&
Private Const DT_EDITCONTROL = &H2000&
Private Const DT_PATH_ELLIPSIS = &H4000&
Private Const DT_END_ELLIPSIS = &H8000&
Private Const DT_MODIFYSTRING = &H10000
Private Const DT_RTLREADING = &H20000
Private Const DT_WORD_ELLIPSIS = &H40000
Private Declare Function PathCompactPath Lib "shlwapi" Alias
"PathCompactPathA" (ByVal hDC As Long, ByVal lpszPath As String, ByVal
dx As Long) As Long
Public Function CompactedPjath(ByVal sPath As String, ByVal lMaxPixels
As Long, ByVal hDC As Long) As String
Dim tR As RECT
tR.right = lMaxPixels
DrawText hDC, sPath, -1, tR, DT_PATH_ELLIPSIS Or DT_SINGLELINE Or
DT_MODIFYSTRING
CompactedPath = sPath
End Function
Public Function CompactedPathSh(ByVal sPath As String, ByVal lMaxPixels
As Long, ByVal hDC As Long) As String
Dim lR As Long
Dim iPos As Long
lR = PathCompactPath(hDC, sPath, lMaxPixels)
iPos = InStr(sPath, Chr$(0))
If iPos <> 0 Then
CompactedPathSh = left$(sPath, iPos - 1)
Else
CompactedPathSh = sPath
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 9
End If
End Function
Thêm vào Form 1 Label:
Private Sub Form_Load()
Label1.Caption =
"C:BinhPhuonggoldsoftDownloadweb_wiz_forums_access2000_v7.01forumindex.
asp"
Label1.Caption = CompactedPathSh(Label1.Caption, Label1.Width
Screen.TwipsPerPixelX, Me.hDC)
End Sub
Thủ Thuật:
Làm cho tên ñường dẫn dài vừa khít với kích thước Label
Giới Thiệu:
Giả sử bạn cần hiển thị 1 ñường dẫn trên một Label. Nhưng nếu tên ñường dẫn quá dài thì có
thể Label không ñủ chỗ ñể hiển thị ñầy ñủ nó. Có 1 cách ñể ñịnh dạng tên ñường dẫn là hiển thị
phần ñầu của ñường dẫn và tên file, bỏ qua những thư mục ở giữa và thay thế chúng bằng dấu
chấm (...). Phương pháp này ñược sử dụng trong nhiều ứng dụng của Microsoft.
Ví Dụ:
Module code:
Option Explicit
Private Type RECT
Left As Long
top As Long
Right As Long
bottom As Long
End Type
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal
hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As
RECT, ByVal wFormat As Long) As Long
Private Const DT_BOTTOM = &H8&
Private Const DT_CENTER = &H1&
Private Const DT_LEFT = &H0&
Private Const DT_CALCRECT = &H400&
Private Const DT_WORDBREAK = &H10&
Private Const DT_VCENTER = &H4&
Private Const DT_TOP = &H0&
Private Const DT_TABSTOP = &H80&
Private Const DT_SINGLELINE = &H20&
Private Const DT_RIGHT = &H2&
Private Const DT_NOCLIP = &H100&
Private Const DT_INTERNAL = &H1000&
Private Const DT_EXTERNALLEADING = &H200&
Private Const DT_EXPANDTABS = &H40&
Private Const DT_CHARSTREAM = 4&
Private Const DT_NOPREFIX = &H800&
Private Const DT_EDITCONTROL = &H2000&
Private Const DT_PATH_ELLIPSIS = &H4000&
Private Const DT_END_ELLIPSIS = &H8000&
Private Const DT_MODIFYSTRING = &H10000
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 10
Private Const DT_RTLREADING = &H20000
Private Const DT_WORD_ELLIPSIS = &H40000
Private Declare Function PathCompactPath Lib "shlwapi" Alias
"PathCompactPathA" (ByVal hDC As Long, ByVal lpszPath As String, ByVal
dx As Long) As Long
Public Function CompactedPjath(ByVal sPath As String, ByVal lMaxPixels
As Long, ByVal hDC As Long) As String
Dim tR As RECT
tR.right = lMaxPixels
DrawText hDC, sPath, -1, tR, DT_PATH_ELLIPSIS Or DT_SINGLELINE Or
DT_MODIFYSTRING
CompactedPath = sPath
End Function
Public Function CompactedPathSh(ByVal sPath As String, ByVal lMaxPixels
As Long, ByVal hDC As Long) As String
Dim lR As Long
Dim iPos As Long
lR = PathCompactPath(hDC, sPath, lMaxPixels)
iPos = InStr(sPath, Chr$(0))
If iPos <> 0 Then
CompactedPathSh = left$(sPath, iPos - 1)
Else
CompactedPathSh = sPath
End If
End Function
Thêm vào Form 1 Label:
Private Sub Form_Load()
Label1.Caption =
"C:BinhPhuonggoldsoftDownloadweb_wiz_forums_access2000_v7.01forumindex.
asp"
Label1.Caption = CompactedPathSh(Label1.Caption, Label1.Width
Screen.TwipsPerPixelX, Me.hDC)
End Sub
Thủ Thuật:
ðổi chuỗi ANSII sang Unicode
Giới Thiệu:
ðổi 1 chuỗi ANSII mô phỏng kiểu gõ VNI sang chuỗi Unicode. Ví dụ: "Ca6u la5c bo65 VB" =>
"Câu lạc bộ VB"
Ví Dụ:
Public Function ConvertToUnicode(sText As String)
Dim i As Integer, j As Integer
Dim sCurChar As String, sPreChar As String, sPreTxt As String
For j = 1 To 2
For i = 2 To Len(sText)
sCurChar = Mid(sText, i, 1)
sPreTxt = Left(sText, i - 2)
sPreChar = Mid(sText, i - 1, 1)
Select Case sCurChar
Case "1"
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 11
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&HE1) &
Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&HC1) &
Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt &
ChrW$(&H1EA5) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt &
ChrW$(&H1EA4) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt &
ChrW$(&H1EAF) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt &
ChrW$(&H1EAE) & Right(sText, Len(sText) - i)
'e
Case "e": sText = sPreTxt & ChrW$(&HE9) &
Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&HC9) &
Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt &
ChrW$(&H1EBF) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt &
ChrW$(&H1EBE) & Right(sText, Len(sText) - i)
'i
Case "i": sText = sPreTxt & ChrW$(&HED) &
Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&HCD) &
Right(sText, Len(sText) - i)
'o
Case "o": sText = sPreTxt & ChrW$(&HF3) &
Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&HD3) &
Right(sText, Len(sText) - i)
Case ChrW$(&HF4): sText = sPreTxt &
ChrW$(&H1ED1) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt &
ChrW$(&H1ED0) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt &
ChrW$(&H1EDB) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt &
ChrW$(&H1EDA) & Right(sText, Len(sText) - i)
'u
Case "u": sText = sPreTxt & ChrW$(&HFA) &
Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&HDA) &
Right(sText, Len(sText) - i)
Case ChrW$(&H1B0): sText = sPreTxt &
ChrW$(&H1EE9) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt &
ChrW$(&H1EE8) & Right(sText, Len(sText) - i)
'y
Case "y": sText = sPreTxt & ChrW$(&HFD) &
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 12
Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&HDD) &
Right(sText, Len(sText) - i)
End Select
Case "2"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&HE0) &
Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&HC0) &
Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt &
ChrW$(&H1EA7) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt &
ChrW$(&H1EA6) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt &
ChrW$(&H1EB1) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt &
ChrW$(&H1EB0) & Right(sText, Len(sText) - i)
'e
Case "e": sText = sPreTxt & ChrW$(&HE8) &
Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&HC8) &
Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt &
ChrW$(&H1EC1) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt &
ChrW$(&H1EC0) & Right(sText, Len(sText) - i)
'i
Case "i": sText = sPreTxt & ChrW$(&HEC) &
Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&HCC) &
Right(sText, Len(sText) - i)
'o
Case "o": sText = sPreTxt & ChrW$(&HF2) &
Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&HD2) &
Right(sText, Len(sText) - i)
Case ChrW$(&HF4): sText = sPreTxt &
ChrW$(&H1ED3) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt &
ChrW$(&H1ED2) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt &
ChrW$(&H1EDD) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt &
ChrW$(&H1EDC) & Right(sText, Len(sText) - i)
'u
Case "u": sText = sPreTxt & ChrW$(&HF9) &
Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&HD9) &
Right(sText, Len(sText) - i)
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 13
Case ChrW$(&H1B0): sText = sPreTxt &
ChrW$(&H1EEB) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt &
ChrW$(&H1EEA) & Right(sText, Len(sText) - i)
'y
Case "y": sText = sPreTxt & ChrW$(&H1EF3) &
Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&H1EF2) &
Right(sText, Len(sText) - i)
End Select
Case "3"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&H1EA3) &
Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&H1EA2) &
Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt &
ChrW$(&H1EA9) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt &
ChrW$(&H1EA8) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt &
ChrW$(&H1EB3) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt &
ChrW$(&H1EB2) & Right(sText, Len(sText) - i)
'e
Case "e": sText = sPreTxt & ChrW$(&H1EBB) &
Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&H1EBA) &
Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt &
ChrW$(&H1EC3) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt &
ChrW$(&H1EC2) & Right(sText, Len(sText) - i)
'i
Case "i": sText = sPreTxt & ChrW$(&H1EC9) &
Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&H1EC8) &
Right(sText, Len(sText) - i)
'o
Case "o": sText = sPreTxt & ChrW$(&H1ECF) &
Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&H1ECE) &
Right(sText, Len(sText) - i)
Case ChrW$(&HF4): sText = sPreTxt &
ChrW$(&H1ED5) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt &
ChrW$(&H1ED4) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt &
ChrW$(&H1EDF) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt &
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 14
ChrW$(&H1EDE) & Right(sText, Len(sText) - i)
'u
Case "u": sText = sPreTxt & ChrW$(&H1EE7) &
Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&H1EE6) &
Right(sText, Len(sText) - i)
Case ChrW$(&H1B0): sText = sPreTxt &
ChrW$(&H1EED) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt &
ChrW$(&H1EEC) & Right(sText, Len(sText) - i)
'y
Case "y": sText = sPreTxt & ChrW$(&H1EF7) &
Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&H1EF6) &
Right(sText, Len(sText) - i)
End Select
Case "4"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&HE3) &
Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&HC3) &
Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt &
ChrW$(&H1EAB) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt &
ChrW$(&H1EAA) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt &
ChrW$(&H1EB5) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt &
ChrW$(&H1EB4) & Right(sText, Len(sText) - i)
'e
Case "e": sText = sPreTxt & ChrW$(&H1EBD) &
Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&H1EBC) &
Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt &
ChrW$(&H1EC5) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt &
ChrW$(&H1EC4) & Right(sText, Len(sText) - i)
'i
Case "i": sText = sPreTxt & ChrW$(&H129) &
Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&H128) &
Right(sText, Len(sText) - i)
'o
Case "o": sText = sPreTxt & ChrW$(&HF5) &
Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&HD5) &
Right(sText, Len(sText) - i)
Tài liệu gửi cauduong.NET Lê Tuấn Vũ
Các thủ thuật hay nhất trong Visual Basic 6.0 15
Case ChrW$(&HF4): sText = sPreTxt &
ChrW$(&H1ED7) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt &
ChrW$(&H1ED6) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt &
ChrW$(&H1EE1) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt &
ChrW$(&H1EE0) & Right(sText, Len(sText) - i)
'u
Case "u": sText = sPreTxt & ChrW$(&H169) &
Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&H168) &
Right(sText, Len(sText) - i)
Case ChrW$(&H1B0): sText = sPreTxt &
ChrW$(&H1EEF) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt &
ChrW$(&H1EEE) & Right(sText, Len(sText) - i)
'y
Case "y": sText = sPreTxt & ChrW$(&H1EF9) &
Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&H1EF8) &
Right(sText, Len(sText) - i)
End Select
Case "5"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&H1EA1) &
Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&H1EA0) &
Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt &
ChrW$(&H1EAD) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt &
ChrW$(&H1EAC) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt &
ChrW$(&H1EB7) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt &
ChrW$(&H1EB6) & Right(sText, Len(sText) - i)
'e
Case "e": sText = sPreTxt & ChrW$(&H1EB9) &
Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&H1EB8) &
Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt &
ChrW$(&H1EC7) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt &
ChrW$(&H1EC6) & Right(sText, Len(sText) - i)
'i
Case "i": sText = sPreTxt & ChrW$(&H1ECB) &
Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&H1ECA) &
Right(sText, Len(sText) - i)