|
hello,
i am using c#.net in vs 2008.
can anybody say me why the error occured while using System.Drawing.Printing?
I want to print Custom size paper in dot matrix pnrinter for billing purpose. But it print in a4 size paper. so i change my code to the following but this did not work.
Please help me.
The code i use are
PrintDialog pd = new PrintDialog();
PageSetupDialog psd = new PageSetupDialog();
PrintDocument pdoc = new PrintDocument();
PaperSize ps = new PaperSize();
psd.PageSettings = new PageSettings();
psd.PrinterSettings = new PrinterSettings();
bool flag = false;
foreach (PaperSize ps1 in psd.PrinterSettings.PaperSizes)
{
if (ps1.PaperName.Contains("Custom"))
{
ps = ps1;
flag = true;
}
}
if (flag)
{
ps.Height = 5;
ps.Width = 3;
psd.PageSettings.PaperSize = ps;
printDocument1.DefaultPageSettings = psd.PageSettings;
printDocument1.PrinterSettings = psd.PrinterSettings;
pd.Document = printDocument1;
if (pd.ShowDialog() == DialogResult.OK)
printDocument1.Print();
}
I wating for replu.
|
|
|
|
|
Member 3330658 wrote: can anybody say me why the error occured while using System.Drawing.Printing
What was the error and where did it occur?
One possible problem you have is your paper size (5/3). Size is given in hundredths of an inch, so that would be quite small paper size.
|
|
|
|
|
thanks for responding me,
i am getting error while altering the height and width of the papersize object.
actually i want the height dynamically assigned by any variable containg the size of the line to be printed.
I want to print the bill in the dot matrix printer. with contineous paper feed.
thanks in advance.
|
|
|
|
|
Okay, but what's the error?
|
|
|
|
|
here the error occured. in the line ps.Height = 5;
the error is
PaperSize cannot be changed unless the Kind property is set to Custom.
i tried the code below
the error did not occure but the width and height of the paper did not changed in the print dialog and while printing.
ps = new PaperSize("Custom Size", 2, 2);
ps.Height = 2;
ps.Width = 2;
please help me i have pursed my job here............................
|
|
|
|
|
|
i want to convert date time to a string representation
e.g. 30/12/2009 -- 30 day of December two thousand nine
Ferron
|
|
|
|
|
Its very simple...
stringVariable = Convert.ToString(MyDate);
Software Development & Web Development is my addiction. I am a Visual C# 2.0 and ASP.NET 2.0 Developer and working in Visual Studio 2005 using Dot Net Framework 2.0.
Email: bottomless.wisdom@hotmail.com
Web: http://bottomless-wisdom.spaces.live.com
|
|
|
|
|
|
You can either use the Convert object
string myDateString = Convert.ToString(myDateTimeObject);
or you can use
string myDateStr = myDateTimeObject.ToString("yyyyMMdd");
or you can use
http:
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
i tried what you guys suggested and it doesn't seem to be working. What i really want something to convert from the datetime e.g.
12/3/2007
to
12 of December two thousand seven
here is my code
String mydateString = System.DateTime.Now.ToString("ddMMyyyy");
lblDATE0.Text = Convert.ToString(mydateString);
Ferron
|
|
|
|
|
Hey Guys
I have a pictureBox which gets its Image from the Resources file. And I have a label where I want to display the name of the Image (which is a .jpg Image). How do I get the name of the Image from the Image file without the .jpg extension.
I want the lblInfo to display Cow in this case.
pictureBox1.Image = Resources.Cow;
|
|
|
|
|
// first import System.IO namespace
and then use this one....
lblInfo.Text = Path.GetFileNameWithoutExtension("path of image file");
Software Development & Web Development is my addiction. I am a Visual C# 2.0 and ASP.NET 2.0 Developer and working in Visual Studio 2005 using Dot Net Framework 2.0.
Email: bottomless.wisdom@hotmail.com
Web: http://bottomless-wisdom.spaces.live.com
|
|
|
|
|
Path.GetFileNameWithoutExtension() method needs a string. And the file which I have included in the Resources file is an Image. How do I give Path.GetFileNameWithoutExtension() a string.
I have included the file in the Resources.resx file.
|
|
|
|
|
How can you get an Image Location from an Image object. If that makes it simpler.
|
|
|
|
|
its not possible to get the name from an Image object. You have to code for this. Something like
pictureBox1.Image = Image.FromFile("ImagePath");
pictureBox1.Tag = "ImagePath";
now whenever you need the path, just parse the Tag property of PB.
In your situation, you may use this
Application.StartupPath + "\\Cow.jpg";
noway to get the path from an Image object AFAIK
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Thanx a lot, thats exactly what I wanted to know. Even though I am not very happy, that the Image object does not return the path or the name of the Image.
|
|
|
|
|
hmmm....i see how happy you are by voting 1 rate
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
How to create custom skins for applications using Visual C# 2005 like Media Player 11 or Windows Live Messenger?
Dont give me the link to download a Controls or Component Library...
I want practial help. Just tell me where to start and whats the basic principle of creating skins for Desktop Applications....
I shall be highly thankful to you for this act of kindness...
Software Development & Web Development is my addiction. I am a Visual C# 2.0 and ASP.NET 2.0 Developer and working in Visual Studio 2005 using Dot Net Framework 2.0.
Email: bottomless.wisdom@hotmail.com
Web: http://bottomless-wisdom.spaces.live.com
modified on Friday, January 9, 2009 9:16 PM
|
|
|
|
|
Bottomless Wisdom wrote: Dont give me the link to download a Controls or Component Library...
be polite, always remember that any word in your message wont angry the other members who have answers and avoid to reply because of your words.
if you want to make skin in C# then you will need lots of panels/pictureboxes, you must learn how to dock panels and grab/make controls images, inherits classes and many more. If you are new to this then you have to learn too much before start...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi All,
I have two years experience in writing desktop applications using Visual C++.
I need to learn .NET with emphasis on web development
what books do you recommend ?
|
|
|
|
|
I like this books by MS Press:
"Microsoft .NET Framework 2.0 Web-Based Client Development"
Also try this one from Apress:
"Beginning ASP.NET 2.0 in C Sharp 2005 From Novice to Professional"
Software Development & Web Development is my addiction. I am a Visual C# 2.0 and ASP.NET 2.0 Developer and working in Visual Studio 2005 using Dot Net Framework 2.0.
Email: bottomless.wisdom@hotmail.com
Web: http://bottomless-wisdom.spaces.live.com
|
|
|
|
|
I would highly recommend any books by Dino Esposito. He has been writting some great ASP.Net books for years now, and also speaks at all the major Microsoft events.
Most of code in his ASP.Net books is written in C#.
I would also recommend visiting: http://www.asp.net/learn/[^]
There are a lot of good references and videos there to get you started.
|
|
|
|
|
For some reason my C# app occasionally causes Vista to put up a notice after the app exists that says "This program might require administrator privileges. If this program did not run correctly, try running the program as an administrator."
My app runs fine, and should not require admin. What might I be doing wrong to cause Vista to put up this notice?
Thanks!
|
|
|
|
|
just disable UAC from Control Panel > Users to avoid these useless things
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|