Okay, so I'm working on this Application which will find it's way to the User's AppData folder and find a specific File .prefs File. It should then read that File and find specific Sentences/Names/Whatever pleases you. If it finds a Sentence/Name in that File which matches the one it's supposed to look for, it'll show on the Applications that it've been Completed.

A bit more Detailed;

1. The User clicks on Button1, located on the first Tab.
2. The Application finds it way to X:\Users\*Username*\Example Folder 1\Example.prefs.
3a. The Application then reads the Contents of the File.
3b. The Application searches for specific names, such as; "Example Name" and "Another Example".
4a. If the Application finds the Name, it'll mark it as Accomplished on the Tab it's located at.
4b. If the Application does not find the Name, it'll mark it as Unfinished on the Tab it's located it.
5. When the searching is done, the Progress Bar will be full.(Increments per Search done.)

Note: The Application consists of 1 "Main Row of Tabs" and 1 "Secondary Row of Tabs". The Main Row are 4 Tabs Total, the first one having no Sub-Tabs.

The Secondary Row of Tabs are 6 Tabs total on each Main Row Tab. Except for the First one, being the Tab with information about the Application.

The Obstacles to Overcome:
• I'm a Rookie when it comes to Programming. But have done Minor Programming with Python. Not so Experienced with VB, but very interested in learning it, currently am too, obviously.

• I can't figure out how to edit Text on my Tab(s). As this would be needed for the Application to show the Names and as well as changing the Status to either Accomplished or Unfinished.

• Figure out how to Read the .prefs File and search it's Content for Matches. (Where do I define/save the Names it should search for?

• Figure out how to make the ProgressBar increment per Search done. (I presume this is pretty straight forward using PerformStep, considering I know how to make the Application Search the Contents...?)

That's pretty much the first stuff I need to get running!

I'd appreciate any kind of Help. I have been Googling around and I did read quite a lot of Tutorials as well as a few Tutorials on YouTube. But neither were really of any help to get me Started with this. Guess I'll have to hope there are some Kind Souls out here in the Infinite. :)

Sincerely,
Dealman :?:

Recommended Answers

All 2 Replies

Here's some basic suggestions. You'll have to figure out how to
enter the correct variable values for the text and search strings. And
you'll need to load the Windows Scripting Runtime from the Projects/reference
menu.

Option Explicit
Dim fso As FileSystemObject
Dim strSearch As String
Private Sub cmdFind_Click()
    Dim fil As File, ts As TextStream
    Set fso = New FileSystemObject
    Dim strEnv As String, strLine As String
    Dim blnFound As Boolean
    strEnv = Environ$("APPDATA")
    If fso.FileExists(strEnv & "\Example.pref") Then
        Debug.Print "File Exists"
        Set fil = fso.GetFile(strEnv & "\Example.pref")
        Set ts = fil.OpenAsTextStream(ForReading)
        
        While ts.AtEndOfStream = False
            strLine = ts.ReadLine
            blnFound = SearchString(strLine, "example")
            If blnFound Then
                ' Complete your query
                Exit Sub
            End If
            
        Wend
        
        If Not (blnFound) Then
            MsgBox "String not found", vbOKOnly, "Status"
            Exit Sub
        End If
    Else
        Debug.Print "File does not exist"
    End If
End Sub


Private Function SearchString(StringToSearch As String, Criteria As String) As Boolean
    Dim lngReturn As Long
    lngReturn = InStr(1, StringToSearch, Criteria, vbTextCompare)
    
    If lngReturn > 0 Then
        SearchString = True
    Else
        SearchString = False
    End If
End Function

This seems like an expectation for help in writing your entire application for you, which we DO NOT do here on Daniweb. Show us what you have in code and we will add or help solving errors etc. We will however not do your project for you.:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.