VB加解密代码
Function crypt(Action As String, Key As String, Src As String) As String
'Action
' E encrypts, D decrypts,
'Key is a unique string needed to en/decrypt (either
' hardcode or setup something for the user to enter.
'Src is the string to be en/decrypted.
On Error GoTo errHandler
Dim count As Integer, KeyPos As Integer, KeyLen As Integer, SrcAsc As Integer
Dim Dest As String, Offset As Integer, TmpSrcAsc, SrcPos As Integer
KeyLen = Len(Key)
If Action = "E" Then
Randomize
Offset = (Rnd * 10000 Mod 255) + 1
Dest = Hex$(Offset)
For SrcPos = 1 To Len(Src)
SrcAsc = (Asc(Mid$(Src, SrcPos, 1)) + Offset) Mod 255
If KeyPos < KeyLen Then KeyPos = KeyPos + 1 Else KeyPos = 1
'Fill Dest$ with HEX representation of Encrypted field
'Hex used to keep nasties such as eof or lf from mangling stream
'Use format$ to make Hex$ return " 0" instead of "0" when the same
'values are Xor'ed together (Null) - keeps placeholder for decrypt
SrcAsc = SrcAsc Xor Asc(Mid$(Key, KeyPos, 1))
Dest = Dest + Format$(Hex$(SrcAsc), "@@")
Offset = SrcAsc
Next
ElseIf Action = "D" Then
Offset = Val("&H" + Left$(Src, 2))
For SrcPos = 3 To Len(Src) Step 2
SrcAsc = Val("&H" + Trim(Mid$(Src, SrcPos, 2)))
&
相关文档:
Option Explicit
Dim FSO As New FileSystemObject
Dim currentFolder As Folder
Dim currentFolderName As String
Dim folderItem, fileItem
Private Sub Form_Load()
currentFolderName = FSO.GetFolder(App.Path) & "\content"
SeachFolder (FSO.GetFolder(currentFolderName))
End Sub ......
VB颜色和RGB色互相转换头疼了我好一段时间,如今找到解决办法了
特别贴出来与大家共享
Type RGB
Red As String
Green As String
Blue As String
End Type
Public Function ColorToRGB(ByVal dwColor As Long) As RGB
Dim clrHex ......
在Asp.net中实现文件的上传功能,是非常简单的一件事情,只需要利用微软提供的FileUpload控件即可轻松实现。
LargeFileUpload.aspx代码如下
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="LargeFileUpload.aspx.vb"
Inherits="LargeFileUpload" %>
<!DOCTYPE html PUBLIC "-//W3C/ ......
一。数据类型
Byte 1
字节 无符号
Interger 2
字节
Long 4
字节
Float 4
字节
Double 8
字节
String
Date
Boolean
Currency
Variant
2.
变长字符串和定长字符
系统默认初始值为空字符串;
变长字符串:di ......