Click here to Skip to main content
15,892,643 members
Home / Discussions / C#
   

C#

 
GeneralRe: Only allow for a double in textbox Pin
Luc Pattyn19-Jan-10 13:55
sitebuilderLuc Pattyn19-Jan-10 13:55 
GeneralRe: Only allow for a double in textbox Pin
Dan Mos19-Jan-10 14:08
Dan Mos19-Jan-10 14:08 
AnswerRe: Only allow for a double in textbox Pin
DaveyM6919-Jan-10 14:38
professionalDaveyM6919-Jan-10 14:38 
AnswerRe: Only allow for a double in textbox Pin
OkkiePepernoot19-Jan-10 21:04
OkkiePepernoot19-Jan-10 21:04 
AnswerRe: Only allow for a double in textbox Pin
hasarian1-Aug-11 10:00
hasarian1-Aug-11 10:00 
Questionhook createDCW function in gdi32.dll Pin
toronja7219-Jan-10 11:52
toronja7219-Jan-10 11:52 
AnswerRe: hook createDCW function in gdi32.dll Pin
Dave Kreskowiak19-Jan-10 16:42
mveDave Kreskowiak19-Jan-10 16:42 
QuestionItems.Clear() not working in ComboBox control??? Pin
Xpnctoc19-Jan-10 11:43
Xpnctoc19-Jan-10 11:43 
OK. So I'm trying to inherit from the ComboBox control (desktop) to make a custom time picker based on some unknown interval of time units. Every time the Increment (meaning interval) property is updated, therefore, the list of items needs to be repopulated. The Increment property can also be set using the designer. My item population code is set in a private method:

/// <summary>
/// Repopulates the combo box based on the current military and increment settings.
/// </summary>
private void RepopulateChoices()
{
    Items.Clear();
    //while (Items.Count > 0)
    //    Items.RemoveAt(0);
    int i = 0;
    while (i < 1440)
    {
        DateTime dat = new DateTime(1, 1, 1, i / 60, i % 60, 0);
        if (ShowMilitary)
            Items.Add(dat.ToString("HH:mm"));
        else
            Items.Add(dat.ToString("h:mm tt"));
        i += Increment;
    }
}

You can see the very first thing I do is clear the existing items from the control. I then iterate through 1440 minutes in a day, incrementing in "Increment" number of minutes.

With a default Increment of 30, there should be 48 items in the final list. However, I always see more than 48, and the number increases for every nested container. I.e., after "11:30 PM" comes another entry of "12:00 AM" and the cycle starts all over again.

dropped directly on a form: 96 items (2 days' worth)
dropped into a panel on a form: 192 items (4 days' worth)
dropped into a panel in a TableLayout container on a form: 284 items (6 days' worth)


WHAT THE HECK IS GOING ON HERE?

I have ruled out accidental population routines in the primary app because I can duplicate the behavior dropping this control onto a form in the app where no instance of the control already exists.

The RepopulateChoices() method is the ONLY place where I am populating items. Since that method starts with an Items.Clear() instruction, how on earth can I be getting massive quantities of duplicate entries???
AnswerRe: Items.Clear() not working in ComboBox control??? Pin
Migounette19-Jan-10 12:32
Migounette19-Jan-10 12:32 
GeneralRe: Items.Clear() not working in ComboBox control??? Pin
Xpnctoc20-Jan-10 3:58
Xpnctoc20-Jan-10 3:58 
AnswerRe: Items.Clear() not working in ComboBox control??? Pin
Dan Mos19-Jan-10 12:48
Dan Mos19-Jan-10 12:48 
QuestionWould this validate an Email ??? Pin
Paw Jershauge19-Jan-10 11:19
Paw Jershauge19-Jan-10 11:19 
AnswerRe: Would this validate an Email ??? Pin
Pete O'Hanlon19-Jan-10 12:19
mvePete O'Hanlon19-Jan-10 12:19 
GeneralRe: Would this validate an Email ??? Pin
Paw Jershauge19-Jan-10 20:51
Paw Jershauge19-Jan-10 20:51 
QuestionRunDll32.exe Help Pin
User 674486819-Jan-10 11:07
professionalUser 674486819-Jan-10 11:07 
AnswerRe: RunDll32.exe Help Pin
Paw Jershauge19-Jan-10 11:30
Paw Jershauge19-Jan-10 11:30 
GeneralRe: RunDll32.exe Help Pin
Pete O'Hanlon19-Jan-10 11:45
mvePete O'Hanlon19-Jan-10 11:45 
AnswerRe: RunDll32.exe Help Pin
Pete O'Hanlon19-Jan-10 11:39
mvePete O'Hanlon19-Jan-10 11:39 
GeneralRe: RunDll32.exe Help Pin
User 674486819-Jan-10 20:59
professionalUser 674486819-Jan-10 20:59 
AnswerRe: RunDll32.exe Help Pin
Paw Jershauge19-Jan-10 21:39
Paw Jershauge19-Jan-10 21:39 
QuestionEXCEPTION HANDLING Pin
mukundkallapur19-Jan-10 8:09
mukundkallapur19-Jan-10 8:09 
AnswerRe: EXCEPTION HANDLING Pin
Jimmanuel19-Jan-10 8:14
Jimmanuel19-Jan-10 8:14 
AnswerRe: EXCEPTION HANDLING Pin
Bardy8519-Jan-10 8:36
Bardy8519-Jan-10 8:36 
AnswerRe: EXCEPTION HANDLING Pin
Migounette19-Jan-10 12:15
Migounette19-Jan-10 12:15 
QuestionMobile webbrowser control not displaying local image... Pin
Jacob Dixon19-Jan-10 4:54
Jacob Dixon19-Jan-10 4:54 

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.