|
Hi,
isnt the method you call popping all its args ??
If so, you could contemplate a "duplicate" before the call.
if not, are you sure it is not modifying the stacked values ?
At a more macroscopic level: are you sure a few loads will be noticed amongst those
calls ? I expect call to be more expensive than load, and unless your called method is
extremely short, the loads wouldnt matter much...
Hope this helps.
Luc Pattyn
|
|
|
|
|
Hello Luc,
thanks for your reply.
I will consider what you wrote about the loads.
Can you please extend what you mean with a "duplicate"?
I don't know if other variables will remain into the stack after the calls,
I'll check further into this.
Thanks again!
|
|
|
|
|
Hi Roberto,
I dont know MSIL in detail, but some stack oriented machines have a "duplicate" or "dup"
instruction that just duplicates "top of stack" (I know PostScript has it).
If there is, it may be cheaper than a second load.
BTW I forgot the most obvious tip of all: if the method you call is short, you should
inline it (and if its long, then thats where you should optimize).
Regards,
Luc Pattyn
|
|
|
|
|
hi,
Is there a way to notify the windows application if an insert or update occurs in the database.I don't want to use polling.
people laugh at me because they say im different and I laugh at them because they are all the same.
|
|
|
|
|
|
Thanks for the reply this is what i was looking for
But is it possible to receive notification message when database is in unix environment and your .Net application is in windows environment?
people laugh at me because they say im different and I laugh at them because they are all the same.
|
|
|
|
|
If you are running SQL Server in a UNIX environment it is.
only two letters away from being an asset
|
|
|
|
|
I thought of a nice way to clear all textboxes in an application: run a loop from 0 to Controls.Length (because Controls is the array that contains all the controls in the form) and check that if the control is a textbox then clear it...the problem is how do i check it?
I tried stuff like if (Controls[i] == TextBox) and similar stuff but nothing worked. how can i do it then?
|
|
|
|
|
hi
try this:
<br />
foreach (Control c in Controls)<br />
{<br />
TextBox t;<br />
if ((t = c as TextBox) != null)<br />
{<br />
t.Text = "";<br />
}<br />
}<br />
Greets
M@u
|
|
|
|
|
foreach (Control c in Controls)
{
if (c is TextBox)
{
(c as TextBox).Text = "";
}
}
life is study!!!
|
|
|
|
|
thx for the help you all :P
btw, better way
for (int x = 0; x < Controls.Count; x++)
if (Controls[x] is TextBox)
Controls[x].Text = "";
|
|
|
|
|
Hello,
sharpiesharpie wrote: btw, better way
I don't agree with you at all.
It only works because Text is a member of Control, if you later need a member of Textbox you would have to change your code again.
I would take the first solution "m@u" posted, (with the "as" conversion and "!=null" check)
sharpiesharpie wrote: if (Controls[x] is TextBox)
Controls[x].Text = "";
Two access over an indexer is also not a "better way".
All the best,
Martin
|
|
|
|
|
I have a groupbox which contains some groupboxes in it, the following code will clear all textboxes in the groupbox and in the groupboxes in it:
<br />
if (this.Controls[i] is GroupBox)<br />
{<br />
for (int m = 0; m < Controls[i].Controls.Count; m++)<br />
{<br />
if (Controls[i].Controls[m] is TextBox)<br />
Controls[i].Controls[m].Text = "";<br />
<br />
if (Controls[i].Controls[m] is GroupBox)<br />
{<br />
for (int x = 0; x < Controls[i].Controls[m].Controls.Count; x++)<br />
{<br />
if (Controls[i].Controls[m].Controls[x] is TextBox)<br />
Controls[i].Controls[m].Controls[x].Text = "";<br />
}<br />
}<br />
}<br />
}<br />
|
|
|
|
|
Hello,
Again, I have to tell that this is bad programming!
Notonly that you are accessing again over multible indexer, in this case a recursive method would be the OOP solution.
Please think about that, bevor posting codesnippets like that.
All the best,
Martin
|
|
|
|
|
I prefer it this way:
foreach (Control c in Controls) {
TextBox tb = c as TextBox;
if (tb != null) tb.Text = "";
}
I seldom use "is" (only if you want to check the type but dont need to access any
members of the specialized object).
Luc Pattyn
|
|
|
|
|
Hey coders what's up?
Result required:
to be able to highlight a specific area of an image when a button is turned on.
when a button is turned off remove that highlighting.
Here is my problem:
I have a form that displays a map image inside a picture box control.
I created a graphics object out of the picture box such as *picturebox1.CreateGraphics()*
and then I use it to highlight specific areas of the map when a certain button is turned on
using a transparent brush such as
///////square to be highlighted//////////////
Point[] squareAPoints = new Point[4];
squareAPoints[0] = new Point(100,200);
squareAPoints[1] = new Point(200,200);
squareAPoints[2] = new Point(200,300);
squareAPoints[3] = new Point(100,300);
///////////////////////////////////////////
Graphics grfx = picturebox1.CreateGraphics();
Brush highlighterBrush = SolidBrush(Color.FromArgb(100, Color.Red)) //(setting the alpha to 100)
grfx.FillPolygon(highlighterBrush, squareAPoints)
now when I turn a certain button off I want this highlighting to be removed, how can I do so?
please help with ideas, tutorials, codes, lessons anything to achieve the end results will be appreciated.
|
|
|
|
|
well, you could just add a boolean, as in if button_pressed == false then draw the highlight, else don't.
|
|
|
|
|
oops well let's clear it up
my question was not regarding the button part
it was regarding the graphics part itself
how to remove the highlighting after I've drawn it using FillPolygon?
|
|
|
|
|
Hi
Simply call Picturebox1.Invalidate() and the hilight will be gone
|
|
|
|
|
when i write in visual studio i get dot and arrows instead of spaces how can i remove it
|
|
|
|
|
Edit > Advanced > View White Space
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
I need a DateTimePicker which in(de)crements the date, if the hours in(de)crement at 24h/0h.
I started with two DateTimePickers (date/time). The problem is that the scroling part of the timePicker fires no event, if one hits the scrollbar. So I can not see, if the user enters a new time or increments the time by scrolling.
Are there any solutions?
Thanks!
Ariadne
|
|
|
|
|
hi all,
I need to extract a part of the string using regular expression.Say for example, if we have a string like this,
<?xml version="1.0" encoding="UTF-8"?>,
I need to extract the version part alone.
Can anyone suggest me a regular expression to work out this?
Thanks in advance.
Regards
Anuradha
-- modified at 9:15 Tuesday 6th February, 2007
|
|
|
|
|
Your exemplary string is not displayed. Either replace any < character with < or check the "Ignore HTML tags in this message" option beneath the smilies.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
hi all,
Sorry for the inconvienience.
I need to extract a part of the string using regular expression.Say for example, if we have a string like this,
<?xml version="1.0" encoding="UTF-8"?>,
I need to extract the version part alone.
Can anyone suggest me a regular expression to work out this?
Thanks in advance.
Regards
Anuradha
Thanks in advance.
Regards
Anuradha
|
|
|
|