|
Jamman wrote: Please send solution in C#. I am using ASP.NET,C#
It's rude to ask people to do your work for you. The poster gave you some useful advice. I suggest you use it to solve the problem yourself.
If you want someone to do you your work, go to Rent A Coder. This site is for people who want to learn.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi every buddy
i have to display a image on the page to how to do that?
image is a animated image,
plz help.
Rajeev Kr. Sharma
VRI Software Pvt.Ltd.
New Delhi India
HumOnline.com
Stay Connected
|
|
|
|
|
RajeevKumarSharma wrote: display a image on the page
If you mean a web page, you can use Img[^] tag
If you are trying to use display it in a form, use PictureBox[^] control
*jaans
|
|
|
|
|
private Bitmap MyImage ;
public void ShowMyImage(String fileToDisplay, int xSize, int ySize)
{
// Sets up an image object to be displayed.
if (MyImage != null)
{
MyImage.Dispose();
}
// Stretches the image to fit the pictureBox.
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;
MyImage = new Bitmap(fileToDisplay); HOW TO GIVE HERE FILE PATH WHICH EXIST IN MY PROJECT
pictureBox1.ClientSize = new Size(xSize, ySize);
pictureBox1.Image = (Image) MyImage ;
}
please look on the bold,under line text
Rajeev Kr. Sharma
VRI Software Pvt.Ltd.
New Delhi India
HumOnline.com
Stay Connected
|
|
|
|
|
Just use the relative path for fileToDisplay. Example: "cool.bmp" or "..\\images\\cool.bmp".
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.
|
|
|
|
|
RajeevKumarSharma,
You have to ways. Use Graphics to do it, or use a PictureBox. I am guessing your pretty new to C# so id go with PictureBox.
Regards,
Gareth.
|
|
|
|
|
This should do what you want
Bitmap pic = new Bitmap(fname);
xsize = pic.Width;
ysize = pic.Height;
// Adjust the position of the picture box
pictureBox1.Location = new System.Drawing.Point((0, 0);
// Adjust the size of the picture box
pictureBox1.Size = new System.Drawing.Size(xsize, ysize);
// Display the image
pictureBox1.Image = pic;
|
|
|
|
|
I have a dropdownlist that contains items ,
each item points to the each tablename of a fixed database.
I simply added a blank CrystalReport1 without adding any table, any logon informatio while creating Crystal Report.
and also added CrystalReportViewer Control.
private void Page_Load(object sender, System.EventArgs e)
{
if(dropdownlist1.Selectedvalue=="Table1")
{
SqlConnection con=new SqlConnection();
con.ConnectionString="Server=.;uid=sa;pwd=abc;database=db";
con.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from table1",con);
DataSet ds=new DataSet();
da.Fill(ds);
//ds.Tables.Add();
CrystalReport1 report2=new CrystalReport1();
//report2.SetDatabaseLogon("userid","pwd");
report2.SetDataSource(ds);
//CrystalReportViewer1.DisplayGroupTree = false;
CrystalReportViewer1.ReportSource =report2;
CrystalReportViewer1.RefreshReport();
}
else if(dropdownlist1.Selectedvalue=="Table2")
{
SqlConnection con=new SqlConnection();
con.ConnectionString="Server=.;uid=sa;pwd=abc;database=db";
con.Open();
SqlDataAdapter da = new SqlDataAdapter("select * from table2",con);
DataSet ds=new DataSet();
da.Fill(ds);
//ds.Tables.Add();
CrystalReport1 report2=new CrystalReport1();
//report2.SetDatabaseLogon("userid","pwd");
report2.SetDataSource(ds);
//CrystalReportViewer1.DisplayGroupTree = false;
CrystalReportViewer1.ReportSource =report2;
CrystalReportViewer1.RefreshReport();
}
}
and so on.........
=====================================================
crystal Reprt is coming without data and columns of the table,(Ensuring the table contains data),i think the dataset is not attached ,
How can i attach database and dataset dynamically
Please solve this.....
|
|
|
|
|
Hello.
I have a windows application in C# with Office 2003 interop. On a form I have a TreeView and a new Word instance. I want to know haw can I catch the Drag & Drop event from the TreeView onto the Word Control.
Thanks.
|
|
|
|
|
Anyone used NDoc, it does not compile help when the C# 2.0 templates are in the code, producing null reference exception. Anyone handled this without removing C# templates?
chesnokov
|
|
|
|
|
Don't use NDoc. Microsoft has released SandCastle which takes care of this neatly. At the moment SandCastle is entirely command line driven, but you can find a GUI SandCastle manager here on CodeProject (clickety)[^].
|
|
|
|
|
Why with NDoc. I've found its GUI superb. Command line is much tricky to use. Will see the link if I can just with a single mouse click produce help file.
chesnokov
|
|
|
|
|
NDoc's GUI is superb - and it's the basis of the link that I put above. If it had continued to be developed fully in .NET 2, I'd have no hesitation recommending it - unfortunately it hasn't.
|
|
|
|
|
Could not run it successfully, see the message board of the link you sent me.
If you can help with the problems. It can not be compiled also, just 4 projects out of 6 as I remember in that solution under VS2008.
chesnokov
|
|
|
|
|
Have you downloaded the latest version from CodePlex here[^]?
|
|
|
|
|
Yes. It said you need latest sandcastle also to work? It failed to compile entire solution anyway, but GUI was compiled.
Why can not it work with latest sandcastle from microsoft downloads?
I want to run codeproject or codeplex GUI with microsoft downloaded sandcastle.
BTW. NDoc GUI looks more authentic
chesnokov
|
|
|
|
|
hi there,
i ve a problem in setting DPI in print document, everytime when i click on the button it shows "600 600", but i ve set it 1200 in pageSetupDialog.
here is codes
private void button3_Click(object sender, EventArgs e)
{
PageSetupDialog psd = new PageSetupDialog();
psd.Document = printDocument1;
psd.ShowDialog();
printDocument1.DefaultPageSettings = psd.PageSettings;
printDocument1.PrinterSettings = psd.PrinterSettings;
printDocument1.Print();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
MessageBox.Show(e.Graphics.DpiX.ToString() + " " + e.Graphics.DpiY.ToString());
}
thanks
<div class="ForumSig">Becoming Programmer...</div>
|
|
|
|
|
I don't think you can set the DPI of your printer, it's simply a property of the printer. Instead, you need to scale your image to be the right size to print for that DPI at the size you want.
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 )
|
|
|
|
|
oh, i cant resize my image, actually when i print text in black then its result is good, but when print in light gray or gray the result is bad, lots of dots can be seen,
Printer : HP LaserJet 1020 plus
do you know a good solution?
thanks
Becoming Programmer...
|
|
|
|
|
Hi everybody!
I have a DataTable which has 3 column. First column has type int, the second double, and the third is the product of the first and the second column.
How can i set the third column that the values in it have only 2 decimals after the decimal point?
DataTable dt = new DataTable("test_table");
dt.Columns.Add("column1",typeof(int));
dt.Columns.Add("column2",typeof(double));
dt.Columns.Add("column3",typeof(string),"column1*column2");
dt.Rows.Add(new object[] { 1, 5 });
dt.Rows.Add(new object[] { 2, 4,994 });
dt.Rows.Add(new object[] { 3, 6 });
dataGridView1.Columns.Clear();
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = dt;
dataGridView1.Columns.Add(new DataGridViewTextBoxColumn());
dataGridView1.Columns[0].DataPropertyName = "column1";
dataGridView1.Columns.Add(new DataGridViewTextBoxColumn());
dataGridView1.Columns[1].DataPropertyName = "column2";
dataGridView1.Columns.Add(new DataGridViewTextBoxColumn());
dataGridView1.Columns[2].DataPropertyName = "column3";
Ex: in the second row the third column expression is 2*4,994 = 9,988 but i want that only 9,98 be the value.
I need this because the user can add rows to the datagridview and i want that also in the added rows to function this.
Thanks for your help!
|
|
|
|
|
Hi Noemi Katinka!
Use Math functions. It will round up the values upto given decimal point.
Like Math.Round(ProductAnswer,2)
Hope this will help you.
Regards.
"Save water,It's precious"
|
|
|
|
|
It depends on the rounding you require.
Math.Round does a strange thing, eg:
Math.Round(3.565m, 2).ToString();
Math.Round(3.575m, 2).ToString();
I always use
decimal x = 3.565m;
x.ToString("N2");
as the results are more consistant, trailing digit of 0-4 rounds down and 5-9 rounds up.
For no rounding as in
Noemi Katinka wrote: 9,988 but i want that only 9,98
you need a little function like
public string TrimDecimal(decimal value, int precision)
{
precision++;
string returnString = value.ToString();
int decimalPointPosition = returnString.IndexOf(".");
if (decimalPointPosition > -1)
{
if (returnString.Length > (decimalPointPosition + precision))
{
return returnString.Substring(0, decimalPointPosition + precision);
}
}
return returnString;
}
modified on Thursday, February 07, 2008 4:36:38 AM
|
|
|
|
|
This is called Bankersrounding
DaveyM69 wrote: It depends on the rounding you require.
Math.Round does a strange thing, eg:
// using ToString method because the value is being displayedMath.Round(3.565m, 2).ToString(); // rounds down to 3.56Math.Round(3.575m, 2).ToString(); // rounds up to 3.58
Ohter option = String x = String.Format("{0:9.990,00}", value.ToString());
|
|
|
|
|
Thanks for your idea.
But i resolved it in the following mode:
double d = 9.999 - 0.005;
Console.WriteLine(d.ToString("0.00"));
and this gives me the result 9.99 (what i need).
And when you need a double value with 1 decimal(no rounded) just substract 0.05, and so on for all numbers.
Have a nice day!
|
|
|
|
|
Has anyone worked on how to read the barcode output from the barcode reader.
The barcode reader produces its output in the notepad.
But i want to get the output and then format it.
Kindly suggest on this issue.
|
|
|
|