Click here to Skip to main content
15,914,481 members
Home / Discussions / C#
   

C#

 
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff27-May-09 0:48
mveOriginalGriff27-May-09 0:48 
GeneralRe: reading text file and calculating the working hours for each employee Pin
emmy_23200327-May-09 1:22
emmy_23200327-May-09 1:22 
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff27-May-09 1:28
mveOriginalGriff27-May-09 1:28 
GeneralRe: reading text file and calculating the working hours for each employee Pin
emmy_23200327-May-09 1:36
emmy_23200327-May-09 1:36 
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff27-May-09 1:54
mveOriginalGriff27-May-09 1:54 
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff27-May-09 1:55
mveOriginalGriff27-May-09 1:55 
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff27-May-09 4:29
mveOriginalGriff27-May-09 4:29 
GeneralRe: reading text file and calculating the working hours for each employee Pin
emmy_23200327-May-09 20:58
emmy_23200327-May-09 20:58 
hi there,
i made this

<pre>
string[] allLines = System.IO.File.ReadAllLines(@"C:\new.txt");

foreach (string eachRow in allLines)

{

try

{

string[] rowaArray = eachRow.Split(',');

string enrollID = rowaArray[1];

DateTime date1 = DateTime.Now;

DateTime date2 = Convert.ToDateTime(rowaArray[3] + " " + rowaArray[5]);


TimeSpan dtDiff = date1 - date2;

listBox1.Items.Add(dtDiff.Days + " Days " + dtDiff.Hours + " Hours " + dtDiff.Seconds + " Seconds ");


}

catch

(IndexOutOfRangeException ex)

{ }

}
</pre>
i got this output
28 Days 9 Hours 13 Seconds
28 Days 9 Hours 8 Seconds
27 Days 23 Hours 4 Seconds
27 Days 23 Hours 59 Seconds
27 Days 23 Hours 12 Seconds
27 Days 23 Hours 4 Seconds
27 Days 18 Hours 21 Seconds
27 Days 16 Hours 24 Seconds
27 Days 16 Hours 7 Seconds
27 Days 16 Hours 32 Seconds
27 Days 16 Hours 20 Seconds
27 Days 16 Hours 10 Seconds
27 Days 15 Hours 49 Seconds
27 Days 15 Hours 33 Seconds
27 Days 11 Hours 33 Seconds
27 Days 9 Hours 33 Seconds
27 Days 9 Hours 22 Seconds
26 Days 23 Hours 20 Seconds
26 Days 23 Hours 14 Seconds
26 Days 23 Hours 8 Seconds
26 Days 23 Hours 27 Seconds

is this correct? as i feel it's alphabetical.
i want to also ask.if i made a combobox with all employees numbers(enroll no).what event i should use inorder when i select the enroll no.the required number of hours is displayed.
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff27-May-09 22:08
mveOriginalGriff27-May-09 22:08 
GeneralRe: reading text file and calculating the working hours for each employee Pin
emmy_23200328-May-09 1:11
emmy_23200328-May-09 1:11 
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff28-May-09 1:24
mveOriginalGriff28-May-09 1:24 
GeneralRe: reading text file and calculating the working hours for each employee Pin
emmy_23200328-May-09 1:28
emmy_23200328-May-09 1:28 
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff28-May-09 1:59
mveOriginalGriff28-May-09 1:59 
GeneralRe: reading text file and calculating the working hours for each employee Pin
emmy_23200329-May-09 23:02
emmy_23200329-May-09 23:02 
GeneralRe: reading text file and calculating the working hours for each employee Pin
Henry Minute27-May-09 0:39
Henry Minute27-May-09 0:39 
GeneralRe: reading text file and calculating the working hours for each employee Pin
OriginalGriff27-May-09 0:45
mveOriginalGriff27-May-09 0:45 
QuestionViewer Pin
ellllllllie26-May-09 22:07
ellllllllie26-May-09 22:07 
QuestionA Combobox problem Pin
leung wilson26-May-09 21:51
leung wilson26-May-09 21:51 
AnswerRe: A Combobox problem Pin
Vimalsoft(Pty) Ltd26-May-09 22:54
professionalVimalsoft(Pty) Ltd26-May-09 22:54 
AnswerRe: A Combobox problem Pin
jaypatel51227-May-09 0:23
jaypatel51227-May-09 0:23 
QuestionOffice Ribbon functionality Pin
windhopper26-May-09 21:22
windhopper26-May-09 21:22 
QuestionRe: Office Ribbon functionality Pin
mandar77719-Jul-09 20:34
mandar77719-Jul-09 20:34 
QuestionA small problem with Extended GridView in Edit Mode Pin
M S Nayak26-May-09 20:50
M S Nayak26-May-09 20:50 
QuestionHow do I Generate a Number in C# Pin
Mads11526-May-09 20:20
Mads11526-May-09 20:20 
AnswerRe: How do I Generate a Number in C# Pin
stancrm26-May-09 20:39
stancrm26-May-09 20:39 

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.