Click here to Skip to main content
15,900,258 members
Home / Discussions / C#
   

C#

 
QuestionForEach Loop Pin
Agweet15-Jul-08 22:33
Agweet15-Jul-08 22:33 
AnswerRe: ForEach Loop Pin
J4amieC15-Jul-08 22:37
J4amieC15-Jul-08 22:37 
GeneralRe: ForEach Loop Pin
Agweet15-Jul-08 22:51
Agweet15-Jul-08 22:51 
GeneralRe: ForEach Loop Pin
Agweet16-Jul-08 0:15
Agweet16-Jul-08 0:15 
GeneralRe: ForEach Loop Pin
PIEBALDconsult17-Jul-08 17:34
mvePIEBALDconsult17-Jul-08 17:34 
AnswerRe: ForEach Loop Pin
rah_sin15-Jul-08 22:47
professionalrah_sin15-Jul-08 22:47 
AnswerRe: ForEach Loop Pin
Harvey Saayman15-Jul-08 22:48
Harvey Saayman15-Jul-08 22:48 
QuestionProperties / VS2008 Designer Issue Pin
Harvey Saayman15-Jul-08 21:26
Harvey Saayman15-Jul-08 21:26 
I'm busy working on some user controls...

these are made up of 2 panels on which data is drawn using GDI+ in the form of time lines and clocks. On the time lines i have maskedTextBoxes with the mask "##:##" and in turn shows up as "__:__" when empty.

In the TextChangedEventHandler of each maskedTextBox I try to parse the value to a DateTime property, so if the user input is a valid time the corresponding property to the maskedTextBox is set.

Also in the TextChangedEventHandler the method DrawData() is called which sets some private bool's when certain groups of these DateTime properties are filled in correctly. Ex if the start and stop time of a break is filled in as 09:00 and 09:30 a pie will be drawn behind the clock representing the break.

so far so good. The irritation sits in the containing forms designer code. As per a different thread monday(i think) i noticed my properties set block was getting executes BEFORE the user enteres text in the MaskedTextBoxes. So upon construction of the control all my MaskedTextBoxes had "00:00" in them instead of "__:__".

It was later discovered that the containing form initailizes the properties in its designer code which was executing my set blocks.

as a work around i did the following...
private DateTime postEnd = new DateTime();
public DateTime PostEnd
{
    get
    {
        return postEnd;
    }
    set
    {
        postEnd = value;
        if (postEnd != new DateTime())
        {
            mtxtPostEnd.Text = postEnd.TimeOfDay.ToString();
        }
    }
}


this was working but only for a few of the properties, the others was STILL SHOWING "00:00" Confused | :confused:
i went screwing around in the designer code again and this is what i found...
// 
// breakClockControl3
// 
this.breakClockControl3.AfterTime = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.BreakEnd = new System.DateTime(((long)(0))); // this is what i want all the DateTimes to be
this.breakClockControl3.BreakStart = new System.DateTime(((long)(0)));
this.breakClockControl3.BreakType = "Windo";
this.breakClockControl3.Dock = System.Windows.Forms.DockStyle.Fill;
this.breakClockControl3.Duration = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.Location = new System.Drawing.Point(3, 3);
this.breakClockControl3.Name = "breakClockControl3";
this.breakClockControl3.PostEnd = new System.DateTime(2008, 7, 17, 0, 0, 0, 0); // This i dont want
this.breakClockControl3.PostGrace = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.PostRound = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.PreGrace = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.PreRound = System.TimeSpan.Parse("00:00:00");
this.breakClockControl3.PreStart = new System.DateTime(2008, 7, 17, 0, 0, 0, 0);
this.breakClockControl3.ShiftEnd = new System.DateTime(2008, 7, 17, 0, 0, 0, 0);
this.breakClockControl3.ShiftStart = new System.DateTime(2008, 7, 17, 0, 0, 0, 0);
this.breakClockControl3.Size = new System.Drawing.Size(486, 317);
this.breakClockControl3.TabIndex = 0;


as you can see some of the DateTime's are initialized as new System.DateTime(((long)(0))); which is perfect and others like new System.DateTime(2008, 7, 17, 0, 0, 0, 0); which screws up my work around Cry | :((

Why does the designer do this? i don't get it...

any ideas on what i can do?

thanx

Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL

you.suck = (you.passion != Programming)

AnswerRe: Properties / VS2008 Designer Issue Pin
leppie15-Jul-08 21:46
leppie15-Jul-08 21:46 
GeneralRe: Properties / VS2008 Designer Issue Pin
Harvey Saayman15-Jul-08 21:58
Harvey Saayman15-Jul-08 21:58 
General[Solved] i hope... Pin
Harvey Saayman15-Jul-08 23:14
Harvey Saayman15-Jul-08 23:14 
GeneralRe: [Solved] i hope... Pin
leppie16-Jul-08 5:48
leppie16-Jul-08 5:48 
GeneralRe: [Solved] i hope... Pin
Harvey Saayman16-Jul-08 20:13
Harvey Saayman16-Jul-08 20:13 
AnswerRe: Properties / VS2008 Designer Issue Pin
DaveyM6915-Jul-08 22:37
professionalDaveyM6915-Jul-08 22:37 
QuestionReading word document stream Pin
Miss_hacker15-Jul-08 20:54
Miss_hacker15-Jul-08 20:54 
AnswerRe: Reading word document stream Pin
enginço16-Jul-08 0:23
enginço16-Jul-08 0:23 
QuestionHow to get first N rows from a datatable Pin
panyl15-Jul-08 20:47
panyl15-Jul-08 20:47 
AnswerRe: How to get first N rows from a datatable Pin
Nirandas15-Jul-08 21:21
Nirandas15-Jul-08 21:21 
AnswerRe: How to get first N rows from a datatable [modified] Pin
enginço16-Jul-08 1:00
enginço16-Jul-08 1:00 
GeneralRe: How to get first N rows from a datatable Pin
panyl24-Jul-08 20:16
panyl24-Jul-08 20:16 
GeneralRe: How to get first N rows from a datatable [modified] Pin
enginço25-Jul-08 2:24
enginço25-Jul-08 2:24 
GeneralRe: How to get first N rows from a datatable Pin
panyl25-Jul-08 18:57
panyl25-Jul-08 18:57 
QuestionHow to confirm wheather there is a value in a grid or not Pin
tasumisra15-Jul-08 20:26
tasumisra15-Jul-08 20:26 
AnswerRe: How to confirm wheather there is a value in a grid or not Pin
stancrm15-Jul-08 20:54
stancrm15-Jul-08 20:54 
GeneralRe: How to confirm wheather there is a value in a grid or not Pin
tasumisra15-Jul-08 21:27
tasumisra15-Jul-08 21:27 

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.