|
I'm a java programmer and am not sure how to do property
This code:
public DateTime StartDate<br />
{<br />
get<br />
{<br />
return this.StartDate;<br />
}<br />
set<br />
{<br />
this.StartDate = value;<br />
}<br />
}
creates a stack overflow, whereby if it's set like this:
projectA.StartDate = new DateTime(2007, 12, 15);
This is only call once to initalize it, however it keeps looping around inside the property and overflows the callstack.
Anyone have any ideas what I'm doing wrong?
|
|
|
|
|
gunner_uk2000 wrote: return this.StartDate;
that is refering itself.
you probably want a member variable (say private DateTime startDate; and have your
get and set manipulate it, rather than refer itself.
|
|
|
|
|
You need a member variable, say:
private DateTime _startDate;
and then set and get the member variable using:
get{ return _startDate; }
set{ _startDate = value; }
what you code does is to keep calling the property's setter.
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
I think it should be this
private DateTime _startDate;<br />
<br />
public DateTime StartDate<br />
{<br />
get<br />
{<br />
return _startDate;<br />
}<br />
set<br />
{<br />
_startDate = value;<br />
}<br />
}
The property works as a public getter/setter, but needs to assign the value to an actual (usually private) variable.
|
|
|
|
|
I am getting a mouse click event on a User Control object, which has not been clicked or manipulated in any way, immediately after another class object, base on a User Control, is dropped in the Panel where these objects have been added.
I am using the standard Drag and Drop events to move an object around within the same Panel. I initiate the "DoDragDrop(...)" from a Mouse_Down event in the User Control object that I am dragging.
Does anyone know from where this mouse click event might originates.
|
|
|
|
|
hi to all, i want to do a job per 40 milisecond but i can't !;
timer component can not support this resolution ,
can i access to this resolution in other way?
|
|
|
|
|
you can go for waitable timers
|
|
|
|
|
may I suggest you read my timers article.
|
|
|
|
|
Luc Pattyn wrote: may I suggest you read my timers article.
Shameless plugging going on?
Seriously though, I was going to point him at your article anyway.
|
|
|
|
|
Pete O'Hanlon wrote: Shameless plugging going on?
Of course. That's what articles are for, I would say.
|
|
|
|
|
Luc Pattyn wrote: Of course. That's what articles are for, I would say.
It's all right. I'll forgive you since you link to one of mine.
I'm very magnanimous that way.
|
|
|
|
|
Pete O'Hanlon wrote: I'm very magnanimous that way.
and Mrs. Slocombe is unanimous on that.
|
|
|
|
|
Luc Pattyn wrote: and Mrs. Slocombe is unanimous on that.
Indeed - did you spend all night stroking your poor pussy because it was quivering?
|
|
|
|
|
You'll make Captain Peacock frown once more.
|
|
|
|
|
Did you try all three types of timers?
System.Timers.Timer
System.Threading.Timer
System.Windows.Forms.Timer
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi All,
I have created one project and have installed on GAC. After that I am not able to "debug" my code. Could you please help me to resolve my problem.
Exactly saying, I have created one IE toolbar. That assembly, I have kept it in GAC. But, I am unable to debug that assembly.
Thanks in advance
Thanks and regards,
Srinivas
|
|
|
|
|
Why not just remove it from the GAC?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
did the same, but eventhough the same problem. Could you please help me regarding this.
Thanks and regards
srinivas
|
|
|
|
|
I know a lot of people ask how to get the row index value in a C# datagridview so this code should help them. But I am now stuck.
The data source is created on the fly and is destroyed as soon as it is viewed so I have to retrieve data from the visible datagrid view:
I need to get the string value of my known (row, column). Googling and going through the IDE has been no help. How do I do this?
int i = adObjectDataGridView.CurrentRow.Index;<br />
MessageBox.Show(Convert.ToString(i));<br />
shwa guy
|
|
|
|
|
if you know row# = i, and column# = n, try:
adObjectDataGridView.Rows[i].Cells[n].Value.ToString()
|
|
|
|
|
Alanteigne, you are the man. It worked great. thank you.
shwaguy
|
|
|
|
|
|
In my project I've created an instance of a custom form class. In my form class, I have error detection that simply closes the form if an un-handleable error occurs. Due to the nature of the app, this is the desired behavior. However, I would like an event on the main form to fire off whenever this happens. How can I do this?
I initialize my custom for like this:
frm_myForm myForm = new frm_myForm();
For any other control I want to add a handler for, I would do something like this:
btnShowForm.Click += new System.EventHandler(btnShowForm_Click);
... and create the corresponding function. I applied similar logic to my form instance but it doesn't seem to work that way. (myForm.Closed += new blah blah). Am I missing a key concept here? It seems like this would be functionality used all the time so I fear I'm being dense and not seeing the big picture. Any advice is appreciated...
Alan
|
|
|
|
|
alanteigne wrote: frm_myForm myForm = new frm_myForm();
<br />
myForm.FormClosed += new FormClosedEventHandler(myForm_FormClosed);
|
|
|
|
|
FormClosed. You've gotta be kidding me, that makes too much sense!
Thanks!
|
|
|
|