|
OK, exchange "results a" and "results b" for "return a" and "return b".
|
|
|
|
|
If you return it, then you'd need to pass it as a parameter. Otherwise, it's out of scope, unless it's a member.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
To add to what Christian told you, you will have to change the return type from void to whatever a and b are.
Cheers,
Vikram.
The cold will freeze our stares
We won't care...
|
|
|
|
|
Its a matter of scope
If you have the following;
static int resulta = 0;
public static void MethodOne()
{
result a;
}
public static void MethodTwo()
{
result b;
result a; //Is legal
}
then result a can be referenced in MethodTwo
but if you have
public static void MethodOne()
{
int result a;
}
public static void MethodTwo()
{
result b;
result a; //Is not valid because it is not in scope
}
Hope this helps and that I understood you correctly
Mike
Everybody gotta be somebody
|
|
|
|
|
|
You want to try again ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Morning! I am calculating a percentage and the float value is, say 12.34567, I know float has 7 digits precision, is there any easy way to set the precision to 4 or 2 digits after .? So that I have 12.3 or 12.34, Thanks a lot.
|
|
|
|
|
for rendering, you can use string.format("0.###"), with a # for each level of precision. You can't change what a float can store, however.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you very much for your quck help, you gave me a thought of doing it in a different way, the actual code is String.format({0:#.##}, float).
|
|
|
|
|
Yes, that also works.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi
i have a code like this:
float f = d / (c * b * a) / 1000000;
string.Format("{0 .00}",f);
txtdansite1.Text = f.ToString();
it still does not work and it has the float`s default precision.
help me please
|
|
|
|
|
Console.WriteLine("{0:N2}",value);
(M.BALA SUBRAMANYAM)
|
|
|
|
|
in win application we don`t use console and this syntax does not help,for example:
textbox1.text=string.format("{0:n2}", variable);
and the textbox1 shows: 0.00
|
|
|
|
|
Or simply use
Math.Round(floatvalue,2);
Sujith
|
|
|
|
|
float f=2.37037E-08
Math.Round(f, 2);
textbox1.Text = f.ToString();
still the same problem and the textbox shows 2.37037E-08
|
|
|
|
|
hi
how to copy folders ??
|
|
|
|
|
I'm not sure if there's a Directory.Copy, I don't think so. I suspect you need to create the folder and copy the files recursively.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
There is no direct methods available to Copy a folder as such in C#. You have to itrate the entire source folder and then you have to copy individual File.
Thanks
Balaji
|
|
|
|
|
Hi All,
I am tring to call a paint event with a timer so that the points change depending on the location. I am going to have a for loop that incrementally changes the X location. So I am not sure quite how to do this. This is my paint code:
<br />
private void PictureBox1_Paint(object sender, PaintEventArgs e)<br />
{<br />
Filtered_Tilt f = new Filtered_Tilt();<br />
Graphics g = e.Graphics;<br />
Size ballsize = new Size(30, 30);<br />
Rectangle r = new Rectangle(f.front, ballsize);<br />
Pen p = new Pen(Color.Blue, 4);<br />
front.X = f.x;<br />
front.Y = f.y;<br />
g.DrawEllipse(p, r);<br />
}<br />
I have a timer function that updates the X I then need to call the paint event to refresh the ellipse on the form. How do I do this? x is a global int variable. front is a global point.
***** GLobal Variable*****
public int x, y;
public Point front;
<br />
private void timer1_Tick(object sender, EventArgs e)<br />
{<br />
for (int i = 0; i < pictureBox1.Width; i++)<br />
{<br />
x = i;<br />
}<br />
<br />
}<br />
Thanks,
Laura
|
|
|
|
|
You can never call the Paint event directly. Instead, you force it by doing this:
Invalidate();
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
As CG has pointed out, you call Invalidate() to invalidate the window, which will cause the OS to eventually call your paint handler. In addition, you can call Update() to force the OS to paint your window immediately.
/ravi
|
|
|
|
|
Thanks so much that worked!
|
|
|
|
|
I need to use a Win32 (unmanaged) function, and need to a way to get a pointer to a CSharp function. Is this possible in CSharp?
|
|
|
|
|
Yes, I'm not sure of the mechanics right now, but I know it can be done.
You could look into the Canon SDK wrapper I have here as an article ( I didn't write that bit ). Or you could check www.pinvoke.net to see how it's done via an API that does it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Not from CP but will bring you in the right direction
http://www.informit.com/guides/content.asp?g=dotnet&seqNum=473&rl=1
File Not Found
|
|
|
|