|
How do you force the System.Windows.Forms.DataGrid's scrollbars to show?
I have a data grid where the number of rows is greater than the control can accomadate and I have no way of reaching the bottom rows without the vertical scrollbar working.
Ryan Ehrenreich
Applied Strategies Technology
|
|
|
|
|
I am very new to C#, I have tried to make this work but it is very difficult learning this new language.
Scenario: Three salespeople work at Sunshine Hot Tubs - Andrea, Brittany, and Eric. Write a program that prompts the user for a saleperson's initial. While the user does not type 'Z', continue by promting for the amount of a sale that salesperson made. Calculate the saleperson's Commission as 10 percent of the sale amount, and add the commission to a running total for that salesperson. After the user types 'Z' for an initial, display each salesperson's total commission earned.
Here's what I have so far: (I have commented out compiler errors)
using System;
namespace TubSales
{//Namespace
class SalesPeople
{//Class
static void Main(string[] args)
{// Main
char response;
//double Comm;
Console.WriteLine("Please enter your first initial, or type Z to to find your total commision.");
response = GetChar();
while (response == 'A' || response == 'a')
{
Console.WriteLine("Enter the amount of sales you had.");
//CalculateSales();
}
while (response == 'B' || response == 'b')
{
Console.WriteLine("Enter the amount of sales you had.");
Console.ReadLine();
}
while (response == 'E' || response == 'e')
{
Console.WriteLine("Enter the amount of sales you had.");
Console.ReadLine();
}
if (response == 'Z' || response == 'z')
{
Console.WriteLine("Andrea's total commision is {0}.");//,Comm);
Console.WriteLine("Brittany's total commision {0}.");//,Comm);
Console.WriteLine("Eric's total commision {0}.");//,Comm);
}
Console.WriteLine("Have a Nice Day!");
}//Main
//public static double CalculateSales()
//{
//double Sales;
//double Commision;
//Commision = .10;
//double answer;
//inputString = Console.ReadLine(Sales);
//return answer;
//Comm = Sales * Commision;
//}
public static char GetChar()
{
string inputString;
char answer;
inputString = Console.ReadLine();
answer = Convert.ToChar(inputString);
return answer;
}
}//Class
}//Namespace
|
|
|
|
|
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
|
|
|
|