Modules / Upgraded Functions
one thing that has saved me uncountable hours is the creation of a large module i attach to each new app.
it has many fuctions to make repetitive programming easy.
for example:
VB Code:
Public Function LdFile(sFileName As String) As String ' load a file into a string
Dim ff6 As Integer
ff6 = FreeFile
Open sFileName For Input As #ff6
LdFile = Input$(LOF(ff6), ff6)
Close #ff6
End Function
Public Function SvFile(sNewFileName As String, FileContent As String) As Long ' saves a string to a file
Dim FF5 As Integer
FF5 = FreeFile
Open sNewFileName For Output As #FF5
Print #FF5, FileContent;
Close #FF5
SvFile = Len(FileContent)
End Function
'upgraded Instr intrinsic command
Public Function InStrW(ByRef LookIn As String, ByRef LookFor As String) As Boolean ' break up lookfor into words, check each word for existance in LookIn
Dim arWS() As String
Dim xx As Long
Dim match As Boolean
match = True
arWS = Split(Trim(LookFor), " ")
For xx = 0 To UBound(arWS) - 2
If InStr(LookIn, Trim(arWS(xx))) = 0 Then
match = False
Else
Debug.Print "InstrW = True", (arWS(xx)) & "<", Str(xx), arWS(xx) & "<", "instr return: " & Str(InStr(LookIn, Trim(arWS(xx)))), LookIn, vbTab, LookFor
Debug.Print Trim(arWS(xx))
match = True
InStrW = True
xx = UBound(arWS) - 2
Exit For
End If 'term in string?
Next xx
InStrW = match
End Function
and a bunch of other things like that.
does anyone know where i might find more modules like this?
does anyone have any handy "upgraded intrinisics" they would like to share with me?
i know there is some stuff in the code bank, but i am really looking for upgraded versions of intrinsic commands and common tasks, and only in the form of a working function (APIs ok, References not ok).
one more question-
i find adding this mod to every project help reduce development time. is there any disadvantage / problem to bundling unneeded code with your app? (other than a few Kb of space)
Re: Modules / Upgraded Functions
Quote:
Originally Posted by rnd me
does anyone have any handy "upgraded intrinisics" they would like to share with me?
you might want to consider checking out VBspeed