Click here to Skip to main content
15,898,134 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: VB6 string mutates Pin
codefinger7-May-09 2:38
codefinger7-May-09 2:38 
GeneralRe: VB6 string mutates Pin
ChandraRam7-May-09 22:16
ChandraRam7-May-09 22:16 
GeneralRe: VB6 string mutates Pin
codefinger8-May-09 2:03
codefinger8-May-09 2:03 
GeneralRe: VB6 string mutates Pin
Thomas Krojer8-May-09 2:17
Thomas Krojer8-May-09 2:17 
QuestionRemove Similar Lines Pin
vijay24827-May-09 1:23
vijay24827-May-09 1:23 
AnswerRe: Remove Similar Lines Pin
riced7-May-09 2:16
riced7-May-09 2:16 
GeneralMessage Closed Pin
7-May-09 2:28
vijay24827-May-09 2:28 
GeneralRe: Remove Similar Lines Pin
riced7-May-09 6:52
riced7-May-09 6:52 
To compare the date fields you need to convert them to Date variables, something like
Dim created As Date
Dim created1 As Date
created = CDate(dateTime)
created1 = CDate(dateTime1)

and then compare created with created1.


vijay2482 wrote:
There many be many conditions like this.

Does this mean that the comparisons (other than the dates) might be different?
In other words 'What is it that makes two lines count as similar'?

There's two possible approaches to the problem that I can see, both involve the use of a list.
1. Read the whole file into a list, sort the list, remove the unwanted lines, then write the list out to file. This would mean that the output lines are not necessarily in the same order as the input lines. If that is important it can be got around.

2. Read the input a line at a time. Check if the list contains a matching record. If it does not, add the line to end of list. If it does, check the dates, if the line just read is earlier than the one in list do nothing otherwise replace the list entry. When all lines have been read, output the list.

Either approach is best done using a typed list and an appropriate structure or class to hold a data line. I can't think of a way that your existing code could be modified to deal with this problem.

Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis

GeneralMessage Closed Pin
10-May-09 21:43
vijay248210-May-09 21:43 
GeneralRe: Remove Similar Lines Pin
riced11-May-09 2:28
riced11-May-09 2:28 
GeneralMessage Closed Pin
11-May-09 2:54
vijay248211-May-09 2:54 
GeneralRe: Remove Similar Lines Pin
riced11-May-09 3:06
riced11-May-09 3:06 
GeneralMessage Closed Pin
11-May-09 3:43
vijay248211-May-09 3:43 
GeneralRe: Remove Similar Lines Pin
riced11-May-09 5:32
riced11-May-09 5:32 
Questioncreate process Pin
hrishiS7-May-09 1:15
hrishiS7-May-09 1:15 
AnswerRe: create process Pin
Eddy Vluggen7-May-09 1:29
professionalEddy Vluggen7-May-09 1:29 
GeneralRe: create process Pin
hrishiS7-May-09 1:39
hrishiS7-May-09 1:39 
AnswerRe: create process Pin
Eddy Vluggen7-May-09 8:34
professionalEddy Vluggen7-May-09 8:34 
AnswerRe: create process Pin
Dave Kreskowiak7-May-09 5:09
mveDave Kreskowiak7-May-09 5:09 
GeneralRe: create process Pin
hrishiS7-May-09 22:25
hrishiS7-May-09 22:25 
GeneralRe: create process Pin
Dave Kreskowiak8-May-09 1:19
mveDave Kreskowiak8-May-09 1:19 
QuestionInet Contol in visual Basic Pin
Devkranth Kishore Vanja7-May-09 0:56
Devkranth Kishore Vanja7-May-09 0:56 
AnswerRe: Inet Contol in visual Basic Pin
Dave Kreskowiak7-May-09 4:59
mveDave Kreskowiak7-May-09 4:59 
AnswerRe: Inet Contol in visual Basic Pin
riced7-May-09 6:24
riced7-May-09 6:24 
QuestionSearch files Pin
M.kohulan6-May-09 22:57
M.kohulan6-May-09 22:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.