|
Argh!! He's in my startup!!
|
|
|
|
|
Calm down, calm down.
Breathe deeply, and slowly.
In...
...Out
In...
...Out.
Thats better.
Now, tell me: How long have you been feeling he is in your startup?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
What seems like forever. And just when he says he is uninstalling he pops right back up! He is like Microsoft Search Indexer, even if I disable his service the stupid sh*t never really quits! make it stop make it stop
|
|
|
|
|
Rajdeep.NET wrote: Use CLSID to secure folders in WinXP[^]
Yeah, and only people who don't know any better would think that this is a valid security technique, and it's not a supportable solution. It screws up backup software and what would happen if you lost the batch file that removed the CLSID?? How are you goin gto recover the folder??
Rajdeep.NET wrote: PS: The above link also mentions about hiding a folder, is that somewhat malicious?
No, it's just plain stupid. The only people it stops are the ones who don't know how the file system or Explorer works.
|
|
|
|
|
Hi,
How can run the track bar while reading string from a text file.
eg:
i have a text file which contain
aaaaa
bbbbb
ccc
dddddd
eeee
.
.
etc
i will read these one by one as each row. While reading each row i need to move the trackbar accordingly automaticlly.
Thankyou
YPKI
|
|
|
|
|
Try a ProgressBar , and increment by each step
I are troll
|
|
|
|
|
I think you mean a progress bar - something to show the user haw far through you are? Rather than a track bar - something to let the user change numbers?
if so then:
FileInfo fi = new FileInfo(fileName);
ProgressBar pb = this.pbShowProgress;
pb.Maximum = (int)fi.Length;
string line;
while ((line = file.ReadLine()) != null)
{
pb.Value += line.Length;
}
You may want to add using(...) and / or try - catch to this.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
hi
i need to read XML data from an XML file into C#.i tried using XmlTextReader class but i am not getting all elements.
My XML file is as follows
<?xml version="1.0"?>
<Form1>
<button>username</button>
</Form1>
My code is as follows
XmlTextReader textReader = new XmlTextReader("C:\\books.xml");
textReader.Read();
while (textReader.Read())
{
textReader.MoveToElement();
Console.WriteLine("Attribute Count:" + textReader.Value.ToString());
}
in the above code i am not getting all the nodes and elements...(maybe due to whitespaces)
please give links to any code samples etc...is there any other method to read??
thanks in advance...
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
|
hi there,
I have this text file
Enroll No,194,date2,30/4/2009,time2,0:3:38,Check Out
Enroll No,78,date2,30/4/2009,time2,0:3:43,Check Out
Enroll No,78,date1,30/4/2009,time1,9:44:47,Check In
Enroll No,107,date1,30/4/2009,time1,9:44:52,Check In
Enroll No,108,date1,30/4/2009,time1,9:57:39,Check In
Enroll No,106,date1,30/4/2009,time1,10:40:47,Check In
Enroll No,109,date1,30/4/2009,time1,15:23:30,Check In
Enroll No,107,date2,30/4/2009,time2,17:6:27,Check Out
Enroll No,194,date1,30/4/2009,time1,17:9:44,Check In
Enroll No,132,date1,30/4/2009,time1,17:32:19,Check In
Enroll No,106,date2,30/4/2009,time2,17:35:31,Check Out
Enroll No,78,date2,30/4/2009,time2,17:35:41,Check Out
Enroll No,132,date1,30/4/2009,time1,17:45:2,Check In
Enroll No,108,date2,30/4/2009,time2,18:33:18,Check Out
Enroll No,109,date2,30/4/2009,time2,22:30:18,Check Out
Enroll No,194,date2,1/5/2009,time2,0:4:18,Check Out
Enroll No,132,date2,1/5/2009,time2,0:4:29,Check Out
i'm using windows application c#.net 2005
i want to calculate the number of hours spend by each enroll no.
each employee should workk 7 hours daily and make 182 hours monthly.if the made more than 182 hours will be overtime,if he made less than 182 hours will be deduction.the employee can take 4 or 5 days off each month.
i want to calculate the number of hours he made between 2 dates as he may comes on 30/4/2009 at 8 o'clock pm and leaves 12:00 am that will be on 1/5/2009.
i also want to make a combobox which has enroll no's and the user choose his number then his working hours will be displayed according to his number.i don't know if that possible or not because i'm using this text file.
Best regards,
emmy
|
|
|
|
|
Which part of doing this whole thing are you having trouble with?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
this is the part of teh code i wrote but i can't have anything for an output
i don't know where is the mistake to make it work
StreamReader reader = new StreamReader(@"C:\new.txt");
string line;
while (null != (line = reader.ReadLine()))
{
string[] split = line.Split(new char[] { ';' });
string bit = split[0];
if (bit == Convert.ToString(EnrollNo))
{
date1 = System.Convert.ToDateTime(split[1]);
TimeSpan ts = new TimeSpan();
date2 = Convert.ToDateTime("0:3:43");
ts = date2.Subtract(date1);
listBox1.Items.Add(ts.Days + " Days " + ts.Hours + " Hours " + ts.Seconds + " Seconds ");
break;
}
}
reader.Dispose();
|
|
|
|
|
emmy_232003 wrote: string[] split = line.Split(new char[] { ';' });
emmy_232003 wrote: Enroll No,194,date2,30/4/2009,time2,0:3:38,Check Out
Enroll No,78,date2,30/4/2009,time2,0:3:43,Check Out
Enroll No,78,date1,30/4/2009,time1,9:44:47,Check In
Problem number one: there is no ';' character in your sample file. Lots of ',' characters, though.
Problem number two: the date info is not in the second section, it is in the 4th.
Fix those, then see what happens.
[edit]left the damn "encode html tags" on again![/edit]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
i changed it as you said but still same problem.
i think date1 should be date1 = System.Convert.ToDateTime(split[1]);
i have date1 & date2 if you misunderstand.
StreamReader reader = new StreamReader(@"C:\new.txt");
string line;
while (null != (line = reader.ReadLine()))
{
string[] split = line.Split(new char[] { ',' });
string bit = split[0];
if (bit == Convert.ToString(EnrollNo))
{
date1 = System.Convert.ToDateTime(split[4]);
//date2 = System.Convert.ToDateTime(split[2]);
TimeSpan ts = new TimeSpan();
date2 = Convert.ToDateTime("0:3:43");
ts = date2.Subtract(date1);
// time1 = split[2];
listBox1.Items.Add(ts.Days + " Days " + ts.Hours + " Hours " + ts.Seconds + " Seconds ");
break;
// DateTime dtDate1 = new DateTime(2009, 30, 4, 9,44,52);
// DateTime dtDate2 = new DateTime(2009, 30, 4, 17,6,27);
// TimeSpan dtDiff = dtDate2 - dtDate1;
// MessageBox.Show(dtDiff.ToString());
// If you want the result in No of days
// MessageBox.Show(dtDiff.Days.ToString());
// Total Minutes in the TimeSpanstring
// minutes = dtDiff.TotalMinutes;
// Total Hours in the TimeSpanstring
// int minutes = dtDiff.TotalHours;
}
}
reader.Dispose();
|
|
|
|
|
Noo, no, no, no.
"The 4th section" does not mean "split[4]" - zero based index, remember?
emmy_232003 wrote:
Enroll No,194,date2,30/4/2009,time2,0:3:38,Check Out
Enroll No,78,date2,30/4/2009,time2,0:3:43,Check Out
Enroll No,78,date1,30/4/2009,time1,9:44:47,Check In
On the first line,
string[] split = line.Split(new char[] { ',' });
gives:
split[0] = "Enroll No"
split[1] = "194"
split[2] = "date2"
and so forth.
If you aren't sure, write them out, or check with the debugger.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
you are right
i made this
string[] allLines = System.IO.File.ReadAllLines(@"C:\new.txt");
for (int m = 0; m < allLines.Length; m++)
{
string eachRow = allLines[m].ToString();
string[] rowaArray = eachRow.Split(',');
string enrollID = rowaArray[1].ToString();
date1 = DateTime.Now;
// DateTime time1 = System.Convert.ToDateTime(rowaArray[5].ToString());
date2 = System.Convert.ToDateTime(rowaArray[3].ToString());
// DateTime time2 = System.Convert.ToDateTime(rowaArray[5].ToString());
rowaArray[3].ToString(); // Date
// rowaArray[5].ToString(); // Time
// string Datez = rowaArray[3].ToString() + " " + rowaArray[5].ToString();
TimeSpan ts = new TimeSpan();
// ts = time2.Subtract(time1);
ts = date2.Subtract(date1);
listBox1.Items.Add(ts.Days + " Days " + ts.Hours + " Hours " + ts.Seconds + " Seconds ");
}
but still can't have output as when i add this code
string Datez = rowaArray[3].ToString() + " " + rowaArray[5].ToString();
tells me that Index was outside the bounds of the array.
when i highlight it i have this as o/p
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-27 Days -12 Hours -55 Seconds
-26 Days -12 Hours -55 Seconds
-26 Days -12 Hours -55 Seconds
-26 Days -12 Hours -55 Seconds
-26 Days -12 Hours -55 Seconds
i think it's wrong right
|
|
|
|
|
First, a couple of things to make both our lives easier.
1) Before you paste a code fragment, there is a check box above the "Post message" button, labeled "Encode HTML tags when pasting". If this has a tick in it, the greater than and less than signs are replaced with & g t ; and & l t ; - untick it before you paste a code fragment.
2) Just above the line of smileys is "code block" - this encases your code fragment in <pre> and </pre> so that formatting is preserved.
Without:
DateTime date1;
DateTime date2;
string[] allLines = System.IO.File.ReadAllLines(@"C:\XXTemp\new.txt.txt");
foreach (string eachRow in allLines)
{
string[] rowaArray = eachRow.Split(',');
string enrollID = rowaArray[1];
date1 = DateTime.Now;
date2 = System.Convert.ToDateTime(rowaArray[3] + " " + rowaArray[5]);
TimeSpan ts = date1.Subtract(date2);
MessageBox.Show(ts.Days + " Days " + ts.Hours + " Hours " + ts.Seconds + " Seconds ");
}
With:
DateTime date1;
DateTime date2;
string[] allLines = System.IO.File.ReadAllLines(@"C:\XXTemp\new.txt.txt");
foreach (string eachRow in allLines)
{
string[] rowaArray = eachRow.Split(',');
string enrollID = rowaArray[1];
date1 = DateTime.Now;
date2 = System.Convert.ToDateTime(rowaArray[3] + " " + rowaArray[5]);
TimeSpan ts = date1.Subtract(date2);
MessageBox.Show(ts.Days + " Days " + ts.Hours + " Hours " + ts.Seconds + " Seconds ");
}
As you can see, I have changed yours a little - but not too much.
Try to use foreach, rather than a for loop - it is more readable and obvious.
You don't need all those .ToString() convertions: they are already strings!
What you call "highlighting" I assume means "making it go green"? If so, this is called commenting out - it turns the line from something the compiler will read into something only people will read.
Without the 'rowaArray[3] + " " + rowaArray[5]' bit, you are always ignoring the time. I don't know why the index was outside the bounds of the array, but it might be worth adding some error checking to ensure the data in your file is in the format you are expecting, or a duff line could cause that error.
You don't need the "new TimeSpan()" as you are throwing it away on the next line!
I suspect the answers are "wrong right" because your subtract was the wrong way round!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
thanks for replying me..but
i tried it as you said and no output at all.
do you think i should subtract the time instead of date?.
|
|
|
|
|
Could this be because I output to a MessageBox, instead of a ListBox?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
noo i already changed it
<pre>
DateTime date1;
DateTime date2;
string[] allLines = System.IO.File.ReadAllLines(@"C:\new.txt");
foreach (string eachRow in allLines)
{
string[] rowaArray = eachRow.Split(',');
string enrollID = rowaArray[1];
date1 = DateTime.Now;
date2 = System.Convert.ToDateTime(rowaArray[3] + " " + rowaArray[5]);
//time1=
TimeSpan ts = date1.Subtract(date2);
//MessageBox.Show(ts.Days + " Days " + ts.Hours + " Hours " + ts.Seconds + " Seconds ");
//string Datez = rowaArray[3].ToString() + " " + rowaArray[5].ToString();
//DateTime Dt = Convert.ToDateTime(date2);
// ts = DateTime.Now - Dt; //// Here Give you hours days. minutes.. whatever you want at between 2 dates.
listBox1.Items.Add(ts.Days + " Days " + ts.Hours + " Hours " + ts.Seconds + " Seconds ");
}
</pre>
|
|
|
|
|
Odd. I do in mine, even if I add a ListBox.
What do you get? Do you get something, then an exception?
Try putting the MessageBox.Show back, and see if that gives anything.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
I won't be ignoring you - gotta go to a meeting... back in a few hours.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
I'm back. Is it working now?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
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.
|
|
|
|
|
It's not alphabetical, it is in order of the lines in your file.
I suspect that what you now need to do is tie your enrol no to "check in" and "check out" from your file, and collect the data for display. That bit is over to you, as I do not have the time to do all your homework for you!
The event you are looking for is (predictably enough) "SelectedIndexChanged"
Good luck!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|