Click here to Skip to main content
15,879,613 members
Home / Discussions / Visual Basic
   

Visual Basic

 
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 
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 
It's easy to read a file into an array (use ReadAllLines) and to sort the array (use Array.Sort(yourArray)). But that's where your problems start. This simple approach won't work with your data. You would need to use Array.Sort(yourArray, yourComparer) and doing this will be messy. You have to define a class that implements IComparer (i.e. implements the Compare method). You then have to loop through the array and write it out while dropping duplicates. There is a problem with this approach if the output lines should be in the same order as the input (unless your compare method is clever enough to maintain order).
An alternative is to create a List(Of T) and populate the list as you read through the file. However, you can't use string for the T; you would have to define a suitable type.When each line is read in you can check if there's a match in the list. If there is you either ignore the line or update the created date field. When you have finished reading the file, you then loop through the list writing it to output.
There are other possible ways to solve the problem e.g. you could define a class that has a string property and overrides the Equals method to allow comparisons.
Given some of the problems you have raised (and what I infer about your knowledge of VB.NET), I think you are going to find this difficult.

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

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 
AnswerRe: Search files Pin
Tom Deketelaere6-May-09 23:18
professionalTom Deketelaere6-May-09 23:18 
QuestionSet Folder Name as File Name Pin
vijay24826-May-09 22:44
vijay24826-May-09 22:44 
AnswerRe: Set Folder Name as File Name Pin
dan!sh 6-May-09 23:03
professional dan!sh 6-May-09 23:03 
AnswerRe: Set Folder Name as File Name Pin
riced7-May-09 1:02
riced7-May-09 1:02 
GeneralRe: Set Folder Name as File Name Pin
vijay24827-May-09 1:17
vijay24827-May-09 1:17 
GeneralRe: Set Folder Name as File Name Pin
dan!sh 7-May-09 1:42
professional dan!sh 7-May-09 1:42 

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.