Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows
Visual Basic > API and Miscellaneous sample source codes
Function to add simple encryption to a string.
Function to add simple encryption to a string. 'Trivial String Encryption 'Plug this guy in your app to quickly encrypt a string. 'Will keep your average busybody out. Function crypt$ (action$, key$, src$) 'trivial encryption algorithm) 'usage crypt$("E"ncrypt or "D"ecrypt, keyword, source string)) Dim count%, keypos%, keylen%, srcasc%, dest$, srcpos%, xtest$) keylen = Len(key)) If UCase$(action) = "E" Then) For srcpos = one To Len(src)) srcasc = Asc(Mid$(src, srcpos, one))) If keypos 'Here is a function to round a value up,down,or near 'to another value. Function doRound(value As Double, RStep As Double, Mode As String) As Double ' Mode function ' UP RoundUp ' DN RoundDN ' NE Nearest ' If Mode = "DN" Then doRound = (Int(value / RStep) * RStep) Exit Function End If ' **** mode up If Mode = "UP" Then If value Mod RStep > 0 Then doRound = ((Int(value / RStep) * RStep) + RStep) Else doRound = value End If Exit Function End If If Mode = "NE" Then value = value + (RStep / 2) doRound = (Int(value / RStep) * RStep) Exit Function End If End Function
Privacy Policy
|
Link to Us
|
Links