Click here to Skip to main content
15,886,873 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: In RichTextBox, changing WordWrap affects Undo/Redo? Pin
Alan Burkhart23-Aug-09 14:31
Alan Burkhart23-Aug-09 14:31 
QuestionSmall problem pasting text Pin
Alan Burkhart21-Aug-09 18:06
Alan Burkhart21-Aug-09 18:06 
AnswerRe: Small problem pasting text Pin
εїзεїзεїз21-Aug-09 21:20
εїзεїзεїз21-Aug-09 21:20 
AnswerRe: Small problem pasting text Pin
Luc Pattyn22-Aug-09 0:28
sitebuilderLuc Pattyn22-Aug-09 0:28 
GeneralRe: Small problem pasting text Pin
Alan Burkhart22-Aug-09 2:25
Alan Burkhart22-Aug-09 2:25 
QuestionChanging DateTimePicker MinDateTime to something other than 01/01/1753 Pin
codeprojectalanr21-Aug-09 12:10
codeprojectalanr21-Aug-09 12:10 
AnswerRe: Changing DateTimePicker MinDateTime to something other than 01/01/1753 Pin
Henry Minute21-Aug-09 12:48
Henry Minute21-Aug-09 12:48 
GeneralRe: Changing DateTimePicker MinDateTime to something other than 01/01/1753 Pin
codeprojectalanr22-Aug-09 3:22
codeprojectalanr22-Aug-09 3:22 
Thanks for the reply Henry. I'm still not convinced that it's necessary to impose the fact that there are some problems converting between the calendars on the control itself - this is surely a problem that the programmer creating the application should be in control of.

Despite my claims that I don't have much spare time, I've now taken the short amount of time needed to create a basic TextBox-based control that validates the date. I include the code here for anyone who might find it useful. Shame I haven't got a calendar control to accompany it, but hey, can't win everything!

public partial class DateTimeTextBox : UserControl
{
    private DateTime m_value = DateTime.MinValue;

    public DateTimeTextBox()
    {
        InitializeComponent();
    }

    public DateTime Value
    {
        get
        {
            return m_value;
        }
        set
        {
            m_value = value;
            textBoxDate.Text = m_value.Date.ToShortDateString();
        }
    }

    private bool ValidateDate(string date, out DateTime validatedDate)
    {
        validatedDate = DateTime.MinValue;
        DateTimeConverter dtc = new DateTimeConverter();
        try
        {
            validatedDate = (DateTime)dtc.ConvertFromString(date);
        }
        catch
        {
            return false;
        }

        return true;
    }

    private void textBoxDate_Leave(object sender, EventArgs e)
    {
        TextBox textbox = (TextBox)sender;

        if (textbox != null)
        {
            bool validDate = ValidateDate(textbox.Text, out m_value);

            if (!validDate)
            {
                MessageBox.Show("Invalid date");
                textbox.Focus();
            }
        }
    }
}

GeneralRe: Changing DateTimePicker MinDateTime to something other than 01/01/1753 Pin
Henry Minute22-Aug-09 6:00
Henry Minute22-Aug-09 6:00 
GeneralRe: Changing DateTimePicker MinDateTime to something other than 01/01/1753 Pin
Todd Carnes9-Apr-10 14:20
Todd Carnes9-Apr-10 14:20 
QuestionRemove border of group box Pin
Aman Bhullar20-Aug-09 3:19
Aman Bhullar20-Aug-09 3:19 
AnswerRe: Remove border of group box Pin
Luc Pattyn20-Aug-09 3:28
sitebuilderLuc Pattyn20-Aug-09 3:28 
AnswerRe: Remove border of group box Pin
Dave Kreskowiak20-Aug-09 3:33
mveDave Kreskowiak20-Aug-09 3:33 
AnswerRe: Remove border of group box Pin
εїзεїзεїз21-Aug-09 11:00
εїзεїзεїз21-Aug-09 11:00 
GeneralRe: Remove border of group box Pin
KatMagic10-Feb-10 9:00
professionalKatMagic10-Feb-10 9:00 
AnswerRe: Remove border of group box Pin
Mugdha_Aditya29-Dec-11 17:04
Mugdha_Aditya29-Dec-11 17:04 
Questionrun the windows application(c#) on dual screen simultaneously. Pin
varunchetu20-Aug-09 1:36
varunchetu20-Aug-09 1:36 
AnswerRe: run the windows application(c#) on dual screen simultaneously. Pin
Luc Pattyn20-Aug-09 2:29
sitebuilderLuc Pattyn20-Aug-09 2:29 
AnswerRe: run the windows application(c#) on dual screen simultaneously. Pin
Dave Kreskowiak20-Aug-09 3:32
mveDave Kreskowiak20-Aug-09 3:32 
AnswerRe: run the windows application(c#) on dual screen simultaneously. Pin
εїзεїзεїз21-Aug-09 10:54
εїзεїзεїз21-Aug-09 10:54 
QuestionNeed solution for vulnerability "IIS 5.0 Denial of Service" Pin
Ankur.Bakliwal19-Aug-09 1:22
Ankur.Bakliwal19-Aug-09 1:22 
AnswerRe: Need solution for vulnerability "IIS 5.0 Denial of Service" Pin
εїзεїзεїз19-Aug-09 2:00
εїзεїзεїз19-Aug-09 2:00 
AnswerRe: Need solution for vulnerability "IIS 5.0 Denial of Service" Pin
Dave Kreskowiak19-Aug-09 3:38
mveDave Kreskowiak19-Aug-09 3:38 
Questionreport writer Pin
εїзεїзεїз18-Aug-09 20:50
εїзεїзεїз18-Aug-09 20:50 
AnswerRe: report writer Pin
Ashfield18-Aug-09 21:14
Ashfield18-Aug-09 21:14 

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.