|
I have a Panel wherein i place textboxes dynamically. I have set AutoScroll property for the Panel to true. So when the size exceeds automatically Vertical Scroll bar appears.
I place dynamic textboxes in sequential order i.e one after the other row wise. I calculate the exact Location and place the control. This works fine.
The problem happens when i use the scroll bar to scroll down and then add few more TextBoxes. Now the location of the new added Text Box after scroll is not properly placed. Eventhough the calculation is the same. There is more gap between the previous and the next TextBox control. Why?
|
|
|
|
|
Hi,
First you should set the position of the Vertical Scroll into "0", then add the controls to the panel. Now it works fine.
this.panel1.VerticalScroll.Value = 0;
this.panel1.Controls.Add(objTextBox);
Regards,
Gopal.S
|
|
|
|
|
Thanks a lot for your help.
I tried setting the position of Vertical scroll to 0 and it worked.
Regards,
|
|
|
|
|
How to get value of one form to another???
ThanXXXXXXXXX in Advance!!!!
Truth Is The Simplest !!!!
modified on Wednesday, February 06, 2008 2:57:40 AM
|
|
|
|
|
Do you mean one FORM to another ? Use delegates ? There are other ways to do it, they are all wrong in comparison, with the possible exception of passing a value through a constructor. There is at least one good article on this on the site, try searching for it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank You!!!
Truth Is The Simplest !!!!
|
|
|
|
|
Can you please give me some guideline for using delegates???
Truth Is The Simplest !!!!
|
|
|
|
|
I have a question.. how do I get icons into C#. I'm talking about icons for toolbars in word editing programs.. Like the change color icon, left/center/right align icons, Bold, Italic, Underline icons.. I know they are stored on the computer somewhere, but where? Do I have attach these images to my program or can you use System.Drawing.Bitmap to display them since they are usually stored in the same folders on every computer using windows?
|
|
|
|
|
They'll be in a .dll (or various .dll's) somewhere, maybe in the MSOffice folder...
But your bitmap idea would work well... just take a screen shot and cut out the icons you want to use
.
Mark.
|
|
|
|
|
Hi,
I need to get a date out of a calendar control (set the CustomFormat to MM/dd/yy hh:mm tt), but when I call Convert.ToDateTime(dtpOrdStart.Value).ToString() I get the date and a random timestamp. Is there any way I can force it to 12:00:00 AM without having to go into the string and replace it myself?
thanx
|
|
|
|
|
Set the time portion of the DateTime ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Actually, you can't. The Hour property and others are read-only.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
Sadly, it appears there is no way to directly do this. You can store the DateTime 's Year , Month , and Day fields in temporary variables and construct a new DateTime object with these.
Warning: I'm not sure, but using dt.AddHours(dt.Hours * (-1)) etc may cause problems with DST. The above method is, I think, the safest.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
calendarControl.SelectedDate.Date
the .Date property of a DateTime is midnight on that date.
|
|
|
|
|
Excellent, 5'd.
Now how did I overlook that?
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
Hello, I need to write a program that has an output:
:
1. The total cost of all the items
2. The total sales tax, which is 8% of the total cost
The gratuity (tip). Most people tip either at the 15%, 20%, or 25% level, so tell the user what the 15% tip is, the 20% tip is, and the 25% tip is
I wrote everything but I do not know how to add a tip as a 15, 20 and 25 percent, so could someone help me out.
class Program
{
static void Main(string[] args)
{
// Price of items
const decimal PriceOnePizza = 0.95M;
const decimal PriceAPairOfHamburger = 2.95M;
const decimal PriceOneHotDog = 4.55M;
const decimal TaxRate = 0.08M; // 5.75%
// Customer personal infoirmation
// Unsigned numbers to represent cleaning items
uint NumberOfPizza, NumberOfHamburger, NumberOfHotDog;
// Each of these sub totals will be used for cleaning items
// Values used to process an order
decimal TotalOrder, TaxAmount, SalesTotal;
Console.WriteLine("-/- Arbys Restaurant -/-");
// Request customer information from the user
// Request the quantity of each category of items
Console.Write("Number of Pizza: ");
string strPizza = Console.ReadLine();
NumberOfPizza = uint.Parse(strPizza);
Console.Write("Number of Hamburger: ");
string strHamburger = Console.ReadLine();
NumberOfHamburger = uint.Parse(strHamburger);
Console.Write("Number of Dresses: ");
string strHotDog = Console.ReadLine();
NumberOfHotDog = uint.Parse(strHotDog);
// Perform the necessary calculations
// Calculate the "temporary" total of the order
// Calculate the tax amount using a constant rate
TaxAmount = TotalOrder * TaxRate;
// Add the tax amount to the total order
SalesTotal = TotalOrder + TaxAmount;
// Communicate the total to the user...
Console.Write("\nThe Total order is: ");
Console.WriteLine(SalesTotal);
// and request money for the order
// Display the receipt
Console.WriteLine("====================================");
Console.WriteLine("-/- Arbys Restaurant -/-");
Console.WriteLine("====================================");
Console.Write("Customer: ");
Console.WriteLine("------------------------------------");
Console.WriteLine("Item Type Qty Unit/Price Sub-Total");
Console.WriteLine("------------------------------------");
Console.Write("Shirts ");
Console.Write(NumberOfPizza);
Console.Write(" ");
Console.Write(PriceOnePizza);
Console.Write(" ");
Console.Write(NumberOfHamburger);
Console.Write(" ");
Console.Write(PriceAPairOfHamburger);
Console.Write(" ");
Console.Write(NumberOfHotDog);
Console.Write(" ");
Console.Write(PriceOneHotDog);
Console.Write(" ");
Console.Write("Total Order: ");
Console.WriteLine(TotalOrder);
Console.Write("Tax Rate: ");
Console.Write(TaxRate * 100);
Console.WriteLine('%');
Console.Write("Tax Amount: ");
Console.WriteLine(TaxAmount);
Console.Write("Total Amount: ");
Console.WriteLine(SalesTotal);
Console.WriteLine("------------------------------------");
Console.WriteLine("====================================");
}
}
}
|
|
|
|
|
It's pretty straightforward. What do you do to calculate 25% ? You have the total, you just need to do the math to work out what 25 % is.
Alex501 wrote: const decimal TaxRate = 0.08M; // 5.75%
.08 is 8%, not 5.75% - the comment is wrong.
You calculate the tip exactly the same way that you calculated the tax.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You already got
Alex501 wrote: TaxAmount = TotalOrder * TaxRate;
so obviously you need to do the same but with the various tip percentages you mentioned
Edit: Sorry Christian - only saw your reply after posting
|
|
|
|
|
*grin* that happens to me all the time.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am working on a printing a report and need to know how to calculate the font width by device. Height is easy (font.GetHeight(graphics);), but there is not a similar setting for width. There used to be an API call (I think it was something like GetTextMatrix) that I used to determine the average width (letters like M and W were wider than letters like I and l). Is there something I can do to check before I start printing? or is there a way that if I ireate through the arrays I can tell what the maximum width are for each column before I start the print page routine.
Thanks,
Leo T. Smith
Program/Analyst Supervisor
|
|
|
|
|
Use the graphics context for the device and call MeasureString.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Thanks,
Leo
Leo T. Smith
Program/Analyst Supervisor
|
|
|
|
|
I installed SQL Server 2005 in my machine couple of months ago now i dn't remember its password to login. Do i have to reinstall so i don't go through this hectic process.. Ya i am a local admin of my machine
|
|
|
|
|
SQL server 2005 had two login modes, "Windows Authentication mode" and "SQL Server and Windows Authentication mode". So that means that you should be able to log in with the Windows Credentials for the user you installed with. Try that and see what you come up with.
Hogan
|
|
|
|
|
It works...
|
|
|
|