|
What were the compiler errors?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
1. Use of unassigned local variable 'Comm'
2. The name 'inputString' does not exist in the class or namespace 'TubSales.SalesPeople'
3. The name 'Comm' does not exist in the class or namespace 'TubSales.SalesPeople'
4. Unreachable code detected
|
|
|
|
|
1. you have declared a variable called Comm in the Main() method, but you don't assign anything to it. You appear to try to do this in the CalculateSales() method, but this is a different scope and cannot see the Comm in the Main() method. TIP: the curly braces {} are scope delimiters if you declare something inside a set of braces then code outside them cannot see it.
2. In the CalculateSales() method you have not declared a variable called inputString. Change the line to read string inputString = Console.ReadLine(Sales);
3. See also (1) above. You need to create a variable called Comm in the CalculateSales() method. The line should read double Comm = Sales * Commision;
4. Swap the last two lines of the CalculateSales() method. After a return statement no more code can run, it is therefore unreachable.
Does this help?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Thank you, That helped alot.
I know this seems very rudemtary but it's like learning spanish in 7 weeks.
|
|
|
|
|
Your welcome.
Also: Es posible aprender un nivel bueno de la idioma española en siete semanas con el curso de Michel Thomas y después de qué, imerción total en la cultura española. (It's been over a year since I did any Spanish so I may have made some mistakes)
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Es posible aprender un buen nivel de español en siete semanas con el curso de Michel Thomas y despues de el cual, una inmersión total el la cultura española.
|
|
|
|
|
Thanks
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
hi,
Better try to consice your question with main points. Otherwise no one will try to read.
See in C# what every input you are giving through console is treating as string. And it's your headache to convert it into your required form.
You can use Console.Read() insted of Console.Readline().
static void Main(string[] args)
{
char Responce;
Console.WriteLine("Please enter your first initial, or type Z to to find your total commision.");
Responce=Convert.ToChar(Console.Read());
Console.WriteLine(Responce.ToString());
}
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
sreejith ss nair wrote:
Better try to consice your question with main points. Otherwise no one will try to read.
By the time you posted this, I'd already answered Larkdog and his problem was solved 11 hours previously.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
hi,
Sorry colin i didn't seen any post at that time. His question is there at the end of descussion record and i my net is too very slow.
I am really sorry.
What i mean by that is try to submit consicely. If it is complex problem we need to give detailed explanation. that's it.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Is there a guideline, maybe from Microsoft, that specifies what to set SmallChange and LargeChange to, possibly as a percentage of the scroll range setting?
Gary Kirkham
A working Program is one that has only unobserved bugs
He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot
Me blog, You read
|
|
|
|
|
|
thanks
Gary Kirkham
A working Program is one that has only unobserved bugs
He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot
Me blog, You read
|
|
|
|
|
SmallChange should be number of visible units on the screen. If you're displaying lines of text, small change should do 1 line change. LargeChange should be full page scroll, so if you can see 50 lines of text, it should be 50.
It gets tricker if you're showing something that is not easily divisible to "lines", image editor for example.
Then I would recommend setting SmallChange so that it takes around 25 clicks to scroll full page down and LargeChange as full page scroll.
|
|
|
|
|
Hi,
I have a control which is created in MFC and I wanna use this control in C#. Actually this control has window but we only use window for messages, we are not displaying anything.
I wanna use this control in my program and it is class library in C# without any interface. Is it possible I can use this control in my class library and create object of that control by programming instead of placing this control on any form or window.
I hope I explained my problem, if there is any confusion please let me know to clearify it.
Thanks,
-Samir.
|
|
|
|
|
isamir wrote:
I hope I explained my problem, if there is any confusion please let me know to clearify it.
I would suggest you read about RCW's (Runtime Callable Wrappers). Are you saying your MFC doesn't expose any interfaces? Read this[^] for starters.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Mfc is exposing interface and events.
I made a wrapper class of MFC ActiveX control and included in my project.
Actually it is MFC ActiveX control without any user interface, it creates window just for messaging and hide it. I want to use this ActiveX control in my C# class library which also has no interface and no windows. When I can trying to create control by calling .CreateControl it give me exception that "windowless ActiveX controls are not supported. Even I tried this in test C# form application and it gives me same error.
Thanks in advance for you help
-Samir.
|
|
|
|
|
|
hi everyone;
i'm working on a project that includes creating a tool that enables the user to create slide shows that will be later viewed on the net. i dont know in what format the slides are going to be saved. does anyone have any idea about the subject . im sure anything would help...
thanks
|
|
|
|
|
The format for saving the slides is up to you. Are you going to code your own viewer or use something off the shelf.
BTW: PowerPoint already does this. All you have to do is install the PowerPoint Viewer[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am rotating text via the Graphics.RotateTransformation technique. After drawing my text string I set the rotation transform back to normal. I then want to draw a "non-rotated" rectangle around the rotated text. Does anyone know how to calculate this rectangle (the largest non-rotated rectangle around the rotated text)??
|
|
|
|
|
Graphics.MeasureString is probably what you want. Depending on your needs, you can resize the SizeF struct you get back. Use that to construct a RectangleF (the PointF for the original will depending on your other transform parameters) and use Graphics.DrawRectangle to draw it.
If you need additional help, please be a little more specific. From what I gather, you want the final surface to display something like this (ASCII art):
_A_
|_B_|
C Is that right?
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
You can use a trick and use Matrix class to rotate points.
For example if you're drawing text within a rectangle (before rotation)
Rectangle rect = ... get draw rectangle ...
... rotate and draw text...
Matrix m = new Matrix();
m.Rotate(angle) or m.RotateAt(m)
Point[] points = new Point[4];
points[0] = new Point(rect.X, rect.Y)
points[1] ... get all 4 corners of the rectangle
for (int i=0; i
|
|
|
|
|
Actually what I needed is a bit more complicated. I first used MeasureString to create a rectangle for the text. Then I want to rotate that rectangle and find the largest "non-rotate" rectangle that rectangle will fit in. I don't care about the location of the largest rectangle, just the width and height. I did figure this out with a bunch of math. here is the routine if anyone is interested.
Note that the rect that is passed into this routine is the rect created using MeasureString.
private RectangleF FindBoundingRect(RectangleF rect, float angle)
{
// Do a quick short cut here if the text is not really rotated
// but is instead horizontal or rotated.
if (angle == 0 || angle == 180 || angle == 360)
{
return new RectangleF(0, 0, rect.Width, rect.Height);
}
else if (angle == 90 || angle == 270)
{
return new RectangleF(0, 0, rect.Height, rect.Width);
}
else if (angle > 360)
{
// Don't handle this case for now.
return new RectangleF(0, 0, 0, 0);
}
// First transform the angle to radians.
float radianAngle = angle * (float)(Math.PI / 180.0F);
float radian90Degrees = 90 * (float)(Math.PI / 180.0F);
// First find the rotated point 1. This is the bottom right point. The radius
// for this point is the width.
float x = (float)(rect.Width * Math.Cos(radianAngle));
float y = (float)(rect.Width * Math.Sin(radianAngle));
PointF p1 = new PointF(x, y);
// Now find point 3 which is also easy. This is the top left point. The
// radius for this point is the height.
x = (float)(rect.Height * Math.Cos(radianAngle + radian90Degrees));
y = (float)(rect.Height * Math.Sin(radianAngle + radian90Degrees));
PointF p3 = new PointF(x, y);
// Point 2, the top right point, is a bit trickier. First find the angle
// from the bottom left up to the top left when the rect is not rotated.
float radianAngleP2 = (float) Math.Atan(rect.Height / rect.Width);
// Now find the length of the diagonal line between these two points.
float radiusP2 = (float) Math.Sqrt((rect.Height * rect.Height) + (rect.Width * rect.Width));
// Now we can find the x,y of point 2 rotated by the specified angle.
x = (float)(radiusP2 * Math.Cos(radianAngle + radianAngleP2));
y = (float)(radiusP2 * Math.Sin(radianAngle + radianAngleP2));
PointF p2 = new PointF(x, y);
// Now based on the original angle we can figure out the width and height
// of our returned rectagle.
float width = 0;
float height = 0;
if (angle < 90)
{
width = p1.X + Math.Abs(p3.X);
height = p2.Y;
}
else if (angle < 180)
{
width = Math.Abs(p2.X);
height = p1.Y + Math.Abs(p3.Y);
}
else if (angle < 270)
{
width = Math.Abs(p1.X) + p3.X;
height = Math.Abs(p2.Y);
}
else
{
width = p2.X;
height = Math.Abs(p1.Y) + p3.Y;
}
return new RectangleF(0, 0, width, height);
}
|
|
|
|
|
Please could you post a full snippet of how to do rotated text as you describe, as that would be useful to know, from my point of view. In olrder apps I have been using LOGFONT stuff and API calls.
Nursey
|
|
|
|