I typed a looong reply just minutes ago and when i clicked preview, i got an error that its for MEMBERS ONLY (although i am still logged in) and my post got vanished :sad:
Here is my question again
I have a small project with two tasks
- Code/implement the BSN (Basic Sorted Neighborhood) method to remove duplicates.
- Code/implement the BSN (Basic Sorted Neighborhood) method to identify the siblings (people who have the same father i.e. they are brothers and sisters of each other)
I have coded almost all of the application but it does not work very well with text files (since it has to read data from text files) over 40 KB. any suggestions to improve it?
Here is the code
1) Loading data in the program (txtnote, txtduplicate and txtKey are text areas)
'This subroutine is for opening a file with the open file menu
' also there is a filtering command which makes the open file
' dialog to only show files with txt format.
Dim text, linecounter As String ' declaring two arrays.
' Enabling the feilds.
txtnote.Enabled = True
MenuItem6.Enabled = True
MenuItem7.Enabled = True
MenuItem8.Enabled = True
MenuItem9.Enabled = True
ofd.Filter = "Text files (*.TXT)|*.TXT" 'Filtering the dialog box.
ofd.ShowDialog() ' This will open a dialog box for selecting a file.
MenuItem2.Enabled = False ' disabling the open button as a file is already opened.
MenuItem3.Enabled = True ' enabling the close button by which we can close the open file.
If ofd.FileName <> "" Then ' checking wheather file opened or not.
' Try is for error handling and messaging appropriate message for an error.
Try
'' I am opening a file in an input mode.
FileOpen(1, ofd.FileName, OpenMode.Input)
Do Until EOF(1) ' Read lines from file.
linecounter = LineInput(1)
''Adding each line to the text variable.
text &= linecounter & vbCrLf
Loop
txtnote.Text = text ' displaying file in the rich text box.
txtnote.Select(1, 0) ' removing the text selection
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical) ' an appropriate message will display if error comes.
Finally
FileClose(1)
End Try
End If
waiting for a reply...