Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
QuestionRegEx help Pin
econner8-Jun-06 9:02
econner8-Jun-06 9:02 
AnswerRe: RegEx help Pin
Dustin Metzgar8-Jun-06 9:06
Dustin Metzgar8-Jun-06 9:06 
GeneralRe: RegEx help Pin
econner8-Jun-06 9:11
econner8-Jun-06 9:11 
GeneralRe: RegEx help Pin
Le centriste8-Jun-06 9:24
Le centriste8-Jun-06 9:24 
GeneralRe: RegEx help Pin
Dustin Metzgar8-Jun-06 9:40
Dustin Metzgar8-Jun-06 9:40 
QuestionHow to get a list of active USB and Floppy-devices? Pin
Martin#8-Jun-06 8:58
Martin#8-Jun-06 8:58 
QuestionRemoving rows depending on date [modified] Pin
Yustme8-Jun-06 8:38
Yustme8-Jun-06 8:38 
AnswerRe: Removing rows depending on date [modified] Pin
Stephan Samuel8-Jun-06 9:50
Stephan Samuel8-Jun-06 9:50 
You're on the right track. You've loaded the data and you're iterating suitably. What you need now is to find the date to cut off at, and start removing records.

To find the day that was 30 days before today, try this:
<br />
DateTime dtOld = DateTime.Now.Date.Subtract(new TimeSpan(30, 0, 0, 0));<br />

Unfortunately, and for good reason, there's no easy constructor for TimeSpan to put in the month value and go. You could find it iterativel, something like this:
<br />
DateTime dtOld = DateTime.Now.Date;<br />
while (dtOld.AddMonths(1).Date > DateTime.Now.Date)<br />
  dtOld = dtOld.Subtract(new TimeSpan(1, 0, 0, 0));<br />

dtOld will contain one month before today when that's running.

Next, you need an int value, because the <Date /> value stored in your XML is really just an int. Use this:
<br />
int intOld = dtOld.ToString("yyyyMMdd");<br />


Now, as you iterate through your set, compare each value to that value. If the int is less than that number, get rid of the data element.

HTH, ask more if you need more help.
GeneralRe: Removing rows depending on date [modified] Pin
Yustme8-Jun-06 10:15
Yustme8-Jun-06 10:15 
GeneralRe: Removing rows depending on date [modified] Pin
Stephan Samuel8-Jun-06 10:57
Stephan Samuel8-Jun-06 10:57 
GeneralRe: Removing rows depending on date [modified] Pin
Yustme8-Jun-06 12:24
Yustme8-Jun-06 12:24 
AnswerRe: Removing rows depending on date [modified] Pin
Stephan Samuel8-Jun-06 13:09
Stephan Samuel8-Jun-06 13:09 
GeneralRe: Removing rows depending on date [modified] Pin
Yustme8-Jun-06 22:04
Yustme8-Jun-06 22:04 
QuestionImages don't show in side toolbar Pin
Alaloom8-Jun-06 8:06
Alaloom8-Jun-06 8:06 
AnswerRe: Images don't show in side toolbar Pin
leppie8-Jun-06 20:48
leppie8-Jun-06 20:48 
QuestionPrinting a TabPage from a TabControl Pin
Mate68-Jun-06 8:04
Mate68-Jun-06 8:04 
AnswerRe: Printing a TabPage from a TabControl Pin
Thomas Stockwell8-Jun-06 14:13
professionalThomas Stockwell8-Jun-06 14:13 
QuestionIs it possible to force the KeyDown Event of a TextBox? Pin
Martin#8-Jun-06 7:50
Martin#8-Jun-06 7:50 
AnswerRe: Is it possible to force the KeyDown Event of a TextBox? Pin
Josh Smith8-Jun-06 8:07
Josh Smith8-Jun-06 8:07 
GeneralRe: Is it possible to force the KeyDown Event of a TextBox? Pin
Martin#8-Jun-06 8:43
Martin#8-Jun-06 8:43 
GeneralRe: Is it possible to force the KeyDown Event of a TextBox? Pin
Josh Smith8-Jun-06 14:23
Josh Smith8-Jun-06 14:23 
GeneralRe: Is it possible to force the KeyDown Event of a TextBox? Pin
Martin#8-Jun-06 20:00
Martin#8-Jun-06 20:00 
GeneralRe: Is it possible to force the KeyDown Event of a TextBox? [modified] Pin
Josh Smith9-Jun-06 1:57
Josh Smith9-Jun-06 1:57 
AnswerRe: Is it possible to force the KeyDown Event of a TextBox? Pin
Martin#9-Jun-06 9:42
Martin#9-Jun-06 9:42 
QuestionHow to install ? Pin
Mohammadreza Heidari8-Jun-06 7:37
Mohammadreza Heidari8-Jun-06 7:37 

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.