4 Replies - 515 Views - Last Post: 28 January 2010 - 06:33 AM Rate Topic: -----

#1 juvedbest  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 08-January 10

assignment help

Posted 27 January 2010 - 02:58 PM

i have this assignment (task sheet attached) but i dont know exactly where should i complete from. i need to extract information from a text file. it involves a complex string manipulation. here is the code that i already did but i am not sure how can i extract the information i need from the appendix in the yask sheet.

 
Imports System.IO

Public Class Extraction

	Private HeadStoneList As New ArrayList()

	Private Sub Extraction_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

	End Sub

	Private Sub btnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click

		Dim objReader As StreamReader

		Dim strLineContent As String
		Dim strTemp As String = ""
		Dim intLineCounter As Integer


		If File.Exists(txtPath.Text) = True Then
			objReader = New StreamReader(Me.txtPath.Text)

			While Not objReader.EndOfStream
				strLineContent = objReader.ReadLine()

				If (strLineContent <> "") Then
					strTemp = strTemp & strLineContent
				End If

				If (strLineContent = "") Then
					Dim strLines() As String
					strLines = strTemp.Split("/")
					HeadStoneList.Add(strLines)
					strTemp = ""
				End If

				intLineCounter = intLineCounter + 1
				'Parsing of lines 
				Dim strArrLines() As String
				For cnt As Integer = 0 To HeadStoneList.Count - 1

					strArrLines = HeadStoneList(cnt)
					For cnt2 As Integer = strArrLines.GetLowerBound(0) To strArrLines.GetUpperBound(0)
						'  LstBxHeadStones.Items.Add(strArrLines(cnt2))
						 


					Next
				Next

			End While



			 
		Else
			MessageBox.Show("The file is not available. Restart the program when the file is available", "Error")
			Me.Close()
		End If

	End Sub


	Private Sub LstBxHeadStones_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LstBxHeadStones.SelectedIndexChanged

	End Sub
End Class

Attached File(s)


This post has been edited by juvedbest: 27 January 2010 - 02:59 PM


Is This A Good Question/Topic? 0
  • +

Replies To: assignment help

#2 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: assignment help

Posted 28 January 2010 - 12:49 AM

Hi,

Did you get the Text File your application has to read from them or do you have to create your own?
Was This Post Helpful? 0
  • +
  • -

#3 Alucard_SA  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 28-January 10

Re: assignment help

Posted 28 January 2010 - 01:22 AM

Howzit!

Looks like you want to read a text file and split each row into its appropriate data field if I'm correct.
You would most likely then use the substring and delimit the strings with commas, to indicate to the program that a comma is acting as a separator between two fields, right? Thats what I would do for this.
Was This Post Helpful? 0
  • +
  • -

#4 juvedbest  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 08-January 10

Re: assignment help

Posted 28 January 2010 - 06:15 AM

View Postmotcom, on 27 Jan, 2010 - 11:49 PM, said:

Hi,

Did you get the Text File your application has to read from them or do you have to create your own?



in the text file i need to have the exact copy of the text there is in the appendix
Was This Post Helpful? 0
  • +
  • -

#5 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: assignment help

Posted 28 January 2010 - 06:33 AM

Hi,

well to start off with you need to know exactly how the text file is formatted...I you do not know that, you will get into trouble, that's why i asked if the file was supplied to you or if you can create one for yourself...

I see the first line of the file will always be the 'Graveyard Name'.

So how will the next line look like?

Like this -> John Doe, 18-01-1933, 19-01-1978

or are the lines underneath each other like this ->

JohnDoe
18-01-1933
19-01-1978

You see if you can create a file your self you can structure your file very neatly and read the data from it.
If the file is given, you have to adjust your code to read the data.

So, if you were given a file by the college for your project, you can paste the first few records on line and we can start analyzing how to extract the data from the file....

;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1