Results 1 to 2 of 2

Thread: Modules / Upgraded Functions

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    372

    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:
    1. Public Function LdFile(sFileName As String) As String ' load a file into a string
    2. Dim ff6 As Integer
    3. ff6 = FreeFile
    4.  
    5. Open sFileName For Input As #ff6
    6.     LdFile = Input$(LOF(ff6), ff6)
    7.     Close #ff6
    8. End Function
    9.  
    10.  
    11. Public Function SvFile(sNewFileName As String, FileContent As String) As Long ' saves a string to a file
    12. Dim FF5 As Integer
    13. FF5 = FreeFile
    14. Open sNewFileName For Output As #FF5
    15.     Print #FF5, FileContent;
    16.     Close #FF5
    17.  SvFile = Len(FileContent)
    18. End Function
    19.  
    20. 'upgraded Instr  intrinsic command
    21. 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
    22.  
    23. Dim arWS() As String
    24. Dim xx As Long
    25. Dim match As Boolean
    26. match = True
    27.  
    28. arWS = Split(Trim(LookFor), " ")
    29.  
    30. For xx = 0 To UBound(arWS) - 2
    31.         If InStr(LookIn, Trim(arWS(xx))) = 0 Then
    32.                 match = False
    33.         Else
    34.             Debug.Print "InstrW = True", (arWS(xx)) & "<", Str(xx), arWS(xx) & "<", "instr return: " & Str(InStr(LookIn, Trim(arWS(xx)))), LookIn, vbTab, LookFor
    35.             Debug.Print Trim(arWS(xx))
    36.            
    37.                 match = True
    38.                  InStrW = True
    39.                 xx = UBound(arWS) - 2
    40.                 Exit For
    41.         End If  'term in string?
    42. Next xx
    43. InStrW = match
    44.  
    45. 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)

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width