|
ah, silly me
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
What were you thinking? Who could possibly expect that the value would be stored in "Value"?
|
|
|
|
|
I guess thats why I'm not allowed to design frameworks...
p.s. how is this going to be handled in .net? is their an artical dealing with how the framework will handle this?
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hey guys,
I'm trying to develop a C# User Control that allows me to send key events. I can use SendKeys.Send() no problem, but it focuses the button so that the button recieves the keydown/keyup/keypress events. I've tried to make my own button and override WndProc(). I'm blocking WM_FOCUS = 7, but no luck. Does anyone have an idea?
Thanks,
Steven
|
|
|
|
|
For the moment I've used labels, SendKeys.Send() and onClick for the labels. Let me know if anyone finds a better solution with buttons.
Thanks,
Steven
|
|
|
|
|
I have a question reg. the .config files.
I know that by using the .config file you can redirect the application to use a different version of an assembly or look in a different location for an assembly.
Do we have to use same public key which the application expects? What happens if I don't provide it?
Don't and drive.
|
|
|
|
|
if you are loading dynamically,
use Assembley and then check version, and major, minor .
need to compair versions and based on that u load that.
check Reflection and Emit classes.
|
|
|
|
|
I've been reading up on delegates and events lately and I'm really confused as to what the event keyword does. Does it actually do anything?
For example, I have this piece of code inside my class:
public delegate bool Validator(char c);
Then I define two members:
protected Validator dVal;
protected event Validator eVal;
And I use them:
dVal += new Validator(Char.IsDigit);
eVal += new Validator(Char.IsDigit);
How is eVal different than dVal ? They both behave identically.
I appreciate your enlightenment.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
|
Thanks Eric. It's nice to hear the answer from the source.
That explains why I couldn't get something like textBox.KeyDown.GetInvocationList() to compile.
Great articles, BTW.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Hi,
I have a form with a RichTextBox on it and I also have an Edit menu that has cut, copy, paste in it. In the handlers for those menu commands I have code like this:
if (rtbNotepad.SelectionLength > 0)
rtbNotepad.Cut (); now everything with the RichTextBox works fine. The problem occurs when I try to paste into anything else. For example I have a regular textbox on the form and I can't cut/copy/paste into it with because the shortcuts are basically hardwired to the RichTextBox. The workaround I'm thinking of is to remove the shortcuts when the RTB loses focus and add them when it gains focus. I don't really like this idea but it's the only one I have at the moment. Does anyone have any better ideas for this problem?
thanks
- monrobot13
|
|
|
|
|
private System.ComponentModel.Container components = null;
I didn't think much of it until last night, when I was being careful to make sure that my Dispose() methods did all that they should.
VS.NET 2002 designer adds the above code to Windows forms/controls. Is this variable actually required by the designer -- it seems not -- and if not, why doesn't the designer actually make use of this elsewhere.
If Container.Dispose() disposed of its contained components, it seems like it could be smart to add controls, etc. to the components Container in the InitializeComponent() method, but I can't find any evidence of the former.
|
|
|
|
|
hi..everyone...
i need help~~
i want to use C# to write a program like this:
when richTextBox focus
a ListBox also gotfocus....and can move up and down
just like design C# code
when user key a keyword(ex: a class's name or a object's name) and key "."
having a listbox show the class's or object's method or property
please help me..................thanks
|
|
|
|
|
I'm having precision problems with the double type, the help files say I should get 15 digits of precision...
BUT...
double d1 = 12589230.0342;<br />
double d2 = -10.335927963256836;<br />
<br />
<br />
double newd = d1+d2;<br />
<br />
Where's all my precision????
I've tried decimal type, but is's incredibly slow.... I have to use it when multiplying, but addition of 10???
Any suggestions?
should I use my own type? Possibly a binary coded decimal
Thanks for any help.
-Sam
|
|
|
|
|
The result I see in the watch window is 12589219.698272036, not 12589220.0.
(the real result is 12589219.698272036743164).
The decimal type can be used (28 digit precision) :
decimal d1 = 12589230.0342M;
decimal d2 = -10.335927963256836M;
decimal d = d1 + d2;
and I get the real result in the watch window.
|
|
|
|
|
YOU'RE right!!!!!
Now that makes things even weirder....
My actual code....
public void Translate(double x, double y, double z)
{
foreach(DPoint p in points)
{
p.x += x;
p.y += y;
p.z += z;
}
}
a Dpoint is just 3 doubles x,y,z
on the first iteration of the foreach:
x=12589230.0342
y = 693719.8863
z = 0.0
p.x = -10.335927963256836
p.y = 9.6102085113525391
p.z = 5.7499995231628418
after first iteration
p.x = 12589220.0
p.y = 693729.5
p.z = 5.7499995231628418
I'm trying to replicate problem is a simple app now...
|
|
|
|
|
This snippet:
decimal px = -10.335927963256836M;<br />
<br />
<br />
decimal ix = 12589230.0342M;<br />
<br />
<br />
decimal nx= px + ix;<br />
<br />
double d = Convert.ToDouble(nx);<br />
<br />
double c = 2;
Works as long as it happens before this line:
device = new Device(graphicsSettings.AdapterOrdinal, graphicsSettings.DevType,
windowed ? ourRenderTarget : this , createFlags, presentParams);
If it happens the line after I get my problem....
now that is messed up, how can it change the behavior of a built in type????
|
|
|
|
|
OK, When you create a directx device it changes all operations to single precision. It can be overridden with the fpupreserve flag.
Thanks for the help.
-Sam
|
|
|
|
|
In C# how can I access a DataSet on Form1 from Form2?
Thanks
__________________
|
|
|
|
|
by making sure the member in Form1 has a public visibility.
|
|
|
|
|
I need help with the string.Format method. If someone could provide a link that offers a comprehensive explanation of all the formatting options (especially for numbers) I'd really appreciate it. In the mean time, here's I need the equivalent of this MFC code:
CString str;
int i = 6;
char c = 'a';
str.Format("%02d", i);
str.Format("%d", i);
str.Format("%02d%c", i, c);
str.Format("%4d", i);
str.Format("%-2d", i);
Thanks in advance!
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
int i = 6;
char c = 'a';
MessageBox.Show( String.Format("{0,2:00}",i) );
MessageBox.Show( String.Format("{0}",i) );
MessageBox.Show( String.Format("{0,2:00}{1,1}",i,c) );
MessageBox.Show( String.Format("{0,4}",i) );
MessageBox.Show( String.Format("{0,-2}",i) );
reference help[^].
|
|
|
|
|
Thanks .S.Rod!
I actually found this[^] nice link which fully explains this stuff in one page -- much better than MSDN.
I have a question on the first version, where you use {0,2:00} . In your opinion is that better than {0:D2} ?
Thanks again,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Alvaro Mendez wrote:
I have a question on the first version, where you use {0,2:00}. In your opinion is that better than {0:D2}?
Using {0:D2} to get 2 zero-padding on the left is just not the right semantics for the grammar. No one should use it.
I wouldn't use {0:D2} since the number just after the D is supposed to represent the amount of digits after the decimal, for instance {0:f3} to format floating numbers with 3 fraction decimals.
Since we are dealing with D, i.e. integers, this number is meaningless but MS choosed to implement it anyway.
|
|
|
|
|
.S.Rod. wrote:
Since we are dealing with D, i.e. integers, this number is meaningless but MS choosed to implement it anyway.
Incredible, so they gave the number after the D a totally different meaning since whole numbers don't have fractional parts anyway.
Thanks for the insight.
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|