Click here to Skip to main content
15,905,913 members
Home / Discussions / C#
   

C#

 
QuestionTreeview problem [modified] Pin
Suhas Bothe9-Nov-06 1:33
Suhas Bothe9-Nov-06 1:33 
AnswerRe: Treeview problem Pin
Robert Rohde9-Nov-06 2:05
Robert Rohde9-Nov-06 2:05 
GeneralRe: Treeview problem Pin
Suhas Bothe9-Nov-06 2:24
Suhas Bothe9-Nov-06 2:24 
GeneralRe: Treeview problem Pin
Robert Rohde9-Nov-06 3:00
Robert Rohde9-Nov-06 3:00 
GeneralRe: Treeview problem Pin
Suhas Bothe9-Nov-06 2:28
Suhas Bothe9-Nov-06 2:28 
GeneralRe: Treeview problem Pin
vinSharp9-Nov-06 22:42
vinSharp9-Nov-06 22:42 
QuestionMulti Monitor Application Pin
blackpenny159-Nov-06 1:24
blackpenny159-Nov-06 1:24 
AnswerRe: Multi Monitor Application Pin
mav.northwind10-Nov-06 20:44
mav.northwind10-Nov-06 20:44 
QuestionIs there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 0:46
Support1239-Nov-06 0:46 
AnswerRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
rah_sin9-Nov-06 0:54
professionalrah_sin9-Nov-06 0:54 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 1:03
Support1239-Nov-06 1:03 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
rah_sin9-Nov-06 1:33
professionalrah_sin9-Nov-06 1:33 
AnswerRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Colin Angus Mackay9-Nov-06 1:00
Colin Angus Mackay9-Nov-06 1:00 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 1:09
Support1239-Nov-06 1:09 
AnswerRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Hunuman9-Nov-06 1:29
Hunuman9-Nov-06 1:29 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 1:44
Support1239-Nov-06 1:44 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Colin Angus Mackay9-Nov-06 6:59
Colin Angus Mackay9-Nov-06 6:59 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Pete O'Hanlon9-Nov-06 1:45
mvePete O'Hanlon9-Nov-06 1:45 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 2:12
Support1239-Nov-06 2:12 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Pete O'Hanlon9-Nov-06 2:27
mvePete O'Hanlon9-Nov-06 2:27 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 2:32
Support1239-Nov-06 2:32 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Pete O'Hanlon9-Nov-06 4:14
mvePete O'Hanlon9-Nov-06 4:14 
Naruto

Try the following wrapper class and test:

using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
<br />
namespace DateWrapper<br />
{<br />
 public class WrappedDate<br />
 {<br />
  private DateTime? _dt = null;<br />
<br />
  /// <summary><br />
  /// Initialize a new instance of <see cref="WrappedDate"/>.<br />
  /// </summary><br />
  public WrappedDate()<br />
  {<br />
  }<br />
<br />
  /// <summary><br />
  /// Initialize a new instance of <see cref="WrappedDate"/>.<br />
  /// </summary><br />
  /// <param name="dt">The date/time to wrap.</param><br />
  public WrappedDate(DateTime dt)<br />
  {<br />
   _dt = dt;<br />
  }<br />
<br />
  /// <summary><br />
  /// Initialize a new instance of <see cref="WrappedDate"/>.<br />
  /// </summary><br />
  /// <param name="dateOnly">The date part without a time.</param><br />
  public WrappedDate(string dateOnly)<br />
   : this(dateOnly, null)<br />
  {<br />
  }<br />
<br />
  /// <summary><br />
  /// Initialize a new instance of <see cref="WrappedDate"/>.<br />
  /// </summary><br />
  /// <param name="date">The date without the time</param><br />
  /// <param name="time">The time portion.</param><br />
  public WrappedDate(string date, string time)<br />
  {<br />
   if (string.IsNullOrEmpty(time))<br />
    time = "00:00:00";<br />
   if (!time.StartsWith(" "))<br />
    time = " " + time;<br />
   while (time.IndexOf("  ") > -1)<br />
   {<br />
    time = time.Replace("  ", " ");<br />
   }<br />
   try<br />
   {<br />
    _dt = Convert.ToDateTime(date + time);<br />
   }<br />
   catch (Exception ex)<br />
   {<br />
    _dt = null;<br />
   }<br />
  }<br />
<br />
  public DateTime? Date<br />
  {<br />
   get { return _dt; }<br />
  }<br />
<br />
 }<br />
<br />
 class Program<br />
 {<br />
  static void Main(string[] args)<br />
  {<br />
   WrappedDate start = new WrappedDate(DateTime.Now);<br />
   WrappedDate dt = new WrappedDate("20/12/2006", "10:00:00");<br />
   WrappedDate finish = new WrappedDate(DateTime.Now.AddHours(1));<br />
   WrappedDate compare = new WrappedDate(DateTime.Now.AddMinutes(30));<br />
   Console.WriteLine(dt.Date.ToString());<br />
<br />
   if (compare.Date >= start.Date && compare.Date <= finish.Date)<br />
    Console.WriteLine("Success");<br />
   else<br />
    Console.WriteLine("Failure");<br />
   Console.ReadLine();<br />
  }<br />
 }<br />
}



Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."

Deja View - the feeling that you've seen this post before.

GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Support1239-Nov-06 5:27
Support1239-Nov-06 5:27 
GeneralRe: Is there a setting in visual studio for the Convert.ToDateTime? Pin
Pete O'Hanlon9-Nov-06 9:11
mvePete O'Hanlon9-Nov-06 9:11 
QuestionTo make possible to manage position and size of controls by mouse Pin
wasek20018-Nov-06 23:59
wasek20018-Nov-06 23:59 

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.