|
|
What?
Regards,
Satips.
|
|
|
|
|
How get Dll's or OCX's ProgID?
|
|
|
|
|
Hi All,
I'm relatively new to C# and have finally come unstuck - so i think anyway. My problem is i have a couple of formula's and the first part is okay but when it gets to the second part i can't seem to get an answer. Below is a sample of what i'm doing and i was just wondering if anyone could give me a point in the right direction?? I have a feeling that it is because the total of sum2 comes back as a decimal value, any way let me know what you think??
int number1; (say value is 10)
int number2; (say value is 6)
int number3; (say value is 2)
int sum; (value would be 4)
int sum2; (should return value of 50)
int iHundred = 100;
sum = number1 - number2;
sum2 = number3 / sum * iHundred;
Also i should say when i debug number3, sum and iHundred all return values and sum2 returns 0
Thanks
Aj...
|
|
|
|
|
Instead of int go for Decimal datatype.
Regards,
Satips.
|
|
|
|
|
Satips wrote: Instead of int go for Decimal datatype.
I think that you mean Double.
Decimal has higher precision, but therefore it's also slower and harder to use. For any normal calculations Double is the preferred type.
---
single minded; short sighted; long gone;
|
|
|
|
|
Also the int iHundred is pointless. Just whenever you want to use iHundred type the number 100, its the same unless you have iHundred change.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Thanks heaps Satips and ExpertComing. I wish you could have given more - but hey, then i wouldn't be learning. Once again thanks i eventually got it all worked out.
Aj...
|
|
|
|
|
Just remember variables are ment to be variables, you can make a variable a constant but you do that for things that you want to change in one place. Numbers will always be a number.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
can I use c++ classes and headers in c# programs or do I have to reimplement
them?
I am thinking of migrating to c# but I do not want to have to recode
all my existing c++/c code.
|
|
|
|
|
Unless you compile the code into a library using a C++ compiler, start rewriting!
|
|
|
|
|
That is not a silly question at all.
I see three options:
1. use an existing native code (i.e. unmanaged) dll and use P/Invoke (only useful
if you dont have the source)
2. compile C/C++ to managed code dll (requires source code)
3. rewrite to C#
If the existing code is large, good functional match and high quality I would go for 2;
otherwise I would go for 3.
-- modified at 11:31 Saturday 9th June, 2007
|
|
|
|
|
i programmed a program and i want it to be loaded autimatically when windows load. how can i do it in C# ?
|
|
|
|
|
Place a shortcut to your .exe in the Startup folder. You can find your start up folder here:
Start menu -> All Programs -> Startup
Not a C# answer, but will get you what you want.
|
|
|
|
|
This has nothing to do with C#.
There are two Startups. When Windows load, you would have to write your app as a windows service. Or, when the user logs in, you can put a shortcut in either of the Startup folders, or the command line in the Run key in the registry.
|
|
|
|
|
I tried what u said and i got that the directory of the StartUp folder exist in Application.StartUp;
String dir = Application.StartUp;
but how can i store the shortcut of the program or how i build an *.job file?
|
|
|
|
|
I've never heard of a "job" file. Nothing in Windows ever uses one.
To create a shortcut is very easy. click and hold the mouse of your .EXE file and drag it away, while holding the Ctrl key down. Notice the little black arrow in one corner if the icon? Let go of the mouse and you've created a shortcut to that .EXE.
|
|
|
|
|
i know how to use it menually. but how can i do it by C#. i mean how can i create a shortCut by C#? but if you entered to the StartUp directory, there is a *.job files. these files containing a details which relevant to activating the program, when and where.....
|
|
|
|
|
|
Beat me to it!
|
|
|
|
|
|
ok, i have a button that i am dragging around. this much i can handle, but then i thought i would put it on a panel (like change the parent attribute) until the time came to use it and then when the button was clicked, it would set the parent to the main form (this)
the issue is when I do this, i can drag the button around ok if i drag very slowly, if i go to fast, the mouse comes off the button and the button no longer drags.
here is the main code. It uses a panel named panel1 and a button named button1
namespace focus_test
{
public partial class Form1 : Form
{
int xOffset, yOffset;
bool buttonClicked;
public Form1()
{
xOffset = yOffset = 0;
buttonClicked = false;
InitializeComponent();
}
private void button1_MouseDown(object sender, MouseEventArgs e)
{
xOffset = e.X;
yOffset = e.Y;
buttonClicked = true;
if (button1.Parent != this)
{
button1.Parent = this;
button1.Left += panel1.Left;
button1.Top += panel1.Top;
}
button1.BringToFront();
}
private void button1_MouseUp(object sender, MouseEventArgs e)
{
buttonClicked = false;
}
private void button1_MouseMove(object sender, MouseEventArgs e)
{
if (buttonClicked)
{
button1.Left += (e.X - xOffset);
button1.Top += (e.Y - yOffset);
}
}
}
}
to see what i am seeing, click on the button and hold down the mouse and drag it around. Going too fast (using the term "fast" loosely) the mouse will end up not over the piece any longer and not send a mouse move message to it anymore.
but
if you go over the button and let go of your mouse then click and drag again, you can go as fast as you want like the poor little mouse is welded to the button.
anyone got any clues as to why this is so?
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
|
|
|
|
|
You have to capture the mouse in the mouse down event.
---
single minded; short sighted; long gone;
|
|
|
|
|
what do you mean?
in the mouse down i currently grab the offset from the button's corner to the mouse, then use that in the mouse move so i can seamlessly move the button in the mouse move by saying button1.Left += (e.X - xOffset); and the same for the top coordinate.
Mouse Down event is only sent once, its not a continuous thing is it? I tried moving in just the mouse down and it only moved once.
"Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price
|
|
|
|
|
AtomRiot wrote: what do you mean?
Exacly what I said.
Have a look at the Capture property of the control that you want to move.
---
single minded; short sighted; long gone;
|
|
|
|