|
-
Mar 17th, 2005, 11:20 AM
#1
Fanatic Member
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:
If InStr(1,sBuilding,sCandidate)=0 then
Add to your count
Concatenate sCandidate onto end of sBuilding
End If
-
Mar 17th, 2005, 11:56 AM
#2
Thread Starter
Frenzied Member
Re: VB6 and ini file
 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:
If InStr(1,sBuilding,sCandidate)=0 then
Add to your count
Concatenate sCandidate onto end of sBuilding
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:
Open strEmailfile For Input As #intFreeFile
Do While Not EOF(intFreeFile)
Line Input #intFreeFile, strEmails
If InStr(1, strTotalEmails, strEmails) = 0 Then
'Add to your count
'Concatenate sCandidate onto end of sBuilding
intEmailCount = intEmailCount + 1
strTotalEmails = strTotalEmails + strEmails
End If
Loop
Close #intFreeFile
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
-
Mar 17th, 2005, 12:08 PM
#3
Fanatic Member
Re: VB6 and ini file
VB Code:
Option Explicit
Private Sub cmdEmail_Click()
'************* open emails from file***********
Dim strEmailfile As String
Dim intFreeFile As Integer
Dim strEmails As String ' Read in
Dim strTotalEmails As String
Dim strDuplicates As String
Dim intEmailCount As Integer
strEmailfile = App.Path & "\emails.ini"
'S:\Disaster Recovery\VB Program Backup\SBO Comm V1.7
'MsgBox (strEmailfile)
intFreeFile = FreeFile
On Error GoTo FinishCheck
Open strEmailfile For Input As #intFreeFile
Do While Not EOF(intFreeFile)
Line Input #intFreeFile, strEmails
If InStr(1, strTotalEmails, strEmails) = 0 Then
'Add to your count
'Concatenate sCandidate onto end of sBuilding
intEmailCount = intEmailCount + 1
strTotalEmails = strTotalEmails & strEmails
Else
strDuplicates = strDuplicates & vbCrLf & strEmails
End If
Loop
Close #intFreeFile
MsgBox ("Email Count = " & intEmailCount)
If Len(strDuplicates) > 0 Then
MsgBox strDuplicates, , " THESE WERE DUPLICATED"
End If
FinishCheck:
End Sub
Hope that does the job.
I'm off to bed now (it's 4:08 AM)
-
Mar 18th, 2005, 05:05 AM
#4
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|