Results 1 to 10 of 10

Thread: VB6 and ini file (RESOLVED)

Hybrid View

  1. #1
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: VB6 and ini file

    This won't be fast.
    As you read in each line, add it to a string.
    But before adding each line, do a test to see if already in the string.
    VB Code:
    1. If InStr(1,sBuilding,sCandidate)=0 then
    2.   Add to your count
    3.   Concatenate sCandidate onto end of sBuilding
    4. End If
    Rob C

  2. #2

    Thread Starter
    Frenzied Member Robbo's Avatar
    Join Date
    Jan 2001
    Location
    Bradford
    Posts
    1,143

    Re: VB6 and ini file

    Quote Originally Posted by RobCrombie
    This won't be fast.
    As you read in each line, add it to a string.
    But before adding each line, do a test to see if already in the string.
    VB Code:
    1. If InStr(1,sBuilding,sCandidate)=0 then
    2.   Add to your count
    3.   Concatenate sCandidate onto end of sBuilding
    4. End If
    cool that seem to work, on neex thing i need to do then is just flag up which ones are doubles, can i put a message box in there?

    have this

    VB Code:
    1. Open strEmailfile For Input As #intFreeFile
    2.   Do While Not EOF(intFreeFile)
    3.     Line Input #intFreeFile, strEmails
    4.    
    5.     If InStr(1, strTotalEmails, strEmails) = 0 Then
    6.     'Add to your count
    7.     'Concatenate sCandidate onto end of sBuilding
    8.         intEmailCount = intEmailCount + 1
    9.         strTotalEmails = strTotalEmails + strEmails
    10.     End If
    11.  
    12.   Loop
    13. Close #intFreeFile
    14.  
    15. MsgBox ("Email Count = " & intEmailCount)
    -----------------------------------------------
    "The hall is rented,"
    "the orchestra is engaged,"
    "its now time to see if you can dance!"
    Q, Q-Who, Star Trek The Next Generation
    -----------------------------------------------
    General Work day

    -----------------------------------------------
    DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle

  3. #3
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: VB6 and ini file

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub cmdEmail_Click()
    4. '************* open emails from file***********
    5.  Dim strEmailfile As String
    6.  Dim intFreeFile As Integer
    7.  Dim strEmails As String ' Read in
    8.  Dim strTotalEmails As String
    9.  Dim strDuplicates As String
    10.  Dim intEmailCount As Integer
    11.  
    12.   strEmailfile = App.Path & "\emails.ini"
    13.   'S:\Disaster Recovery\VB Program Backup\SBO Comm V1.7
    14.   'MsgBox (strEmailfile)
    15.   intFreeFile = FreeFile
    16.  
    17.   On Error GoTo FinishCheck
    18.   Open strEmailfile For Input As #intFreeFile
    19.   Do While Not EOF(intFreeFile)
    20.     Line Input #intFreeFile, strEmails
    21.    
    22.     If InStr(1, strTotalEmails, strEmails) = 0 Then
    23.     'Add to your count
    24.     'Concatenate sCandidate onto end of sBuilding
    25.         intEmailCount = intEmailCount + 1
    26.         strTotalEmails = strTotalEmails & strEmails
    27.     Else
    28.       strDuplicates = strDuplicates & vbCrLf & strEmails
    29.     End If
    30.  
    31.   Loop
    32.   Close #intFreeFile
    33.  
    34.   MsgBox ("Email Count = " & intEmailCount)
    35.   If Len(strDuplicates) > 0 Then
    36.     MsgBox strDuplicates, , " THESE WERE DUPLICATED"
    37.   End If
    38. FinishCheck:
    39. End Sub
    Hope that does the job.
    I'm off to bed now (it's 4:08 AM)
    Rob C

  4. #4

    Thread Starter
    Frenzied Member Robbo's Avatar
    Join Date
    Jan 2001
    Location
    Bradford
    Posts
    1,143

    Resolved Re: VB6 and ini file

    ok thats works ok with a bit of jiging thats just what i want cheers
    -----------------------------------------------
    "The hall is rented,"
    "the orchestra is engaged,"
    "its now time to see if you can dance!"
    Q, Q-Who, Star Trek The Next Generation
    -----------------------------------------------
    General Work day

    -----------------------------------------------
    DOS, Win 95, Win 98 SE, Win ME, Win NT 4.0 SP6a, Windows 2000 SP3, Window XP SP1, Windows 7, Windows 8/8.1, Windows 10, Office 97 Pro, Office 2000 Pro, Office 2010, Office 2013, Office 2016, Office 2019, Visual Basic 6 (SP5), SQL, Oracle

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