Click here to Skip to main content
15,892,059 members
Home / Discussions / C#
   

C#

 
GeneralRe: closing the main form after loading another form Pin
Charlie Williams17-Feb-04 4:19
Charlie Williams17-Feb-04 4:19 
GeneralCalling Managed C++ code in a C# App Pin
granderson16-Feb-04 12:28
granderson16-Feb-04 12:28 
GeneralRe: Calling Managed C++ code in a C# App Pin
obelisk2916-Feb-04 19:41
obelisk2916-Feb-04 19:41 
GeneralMetrics 2 english 2 twips 2 whatever Pin
Tomaž Štih16-Feb-04 11:58
Tomaž Štih16-Feb-04 11:58 
GeneralRe: Metrics 2 english 2 twips 2 whatever Pin
Heath Stewart17-Feb-04 3:52
protectorHeath Stewart17-Feb-04 3:52 
GeneralPrinting from a webservice Pin
nathanreynolds16-Feb-04 11:31
nathanreynolds16-Feb-04 11:31 
GeneralRe: Printing from a webservice Pin
Heath Stewart17-Feb-04 3:26
protectorHeath Stewart17-Feb-04 3:26 
GeneralRe: Printing from a webservice Pin
nathanreynolds17-Feb-04 10:55
nathanreynolds17-Feb-04 10:55 
Heath,
Thanks for your reply. I am trying to print data that is passed into the webservice. I belive I have set up the handler correctly but its still not working. The code works in a regular C# project just fine but not in my webservice. When I browse to the webservice I just get an error "This page cannot be displayed HTTP 500 - Internal server error". It seems as if PrintPageEventArgs object that is passed into the print handler needs some setting up first, but i'm not sure how to do this. Here is my code if anyone cares to point and laugh. Again thanks for any help.

public class Service1 : System.Web.Services.WebService
{
public Service1()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
PrintDocument pd = new PrintDocument();

[WebMethod]
public string printIt()
{


pd.PrinterSettings.PrinterName = @"\\printers\printer / HP";
pd.PrintPage += new PrintPageEventHandler(this.printItHandler);

PrintPageEventArgs ea;
if (pd.PrinterSettings.IsValid)
{
pd.Print();
return "printing worked";
}
return "Printing failed";




}

private void printItHandler(Object sender ,
PrintPageEventArgs e)
{
String textToPrint = "Printing is fun!!";
Font printFont = new Font("Courier New", 12);
int leftMargin = e.MarginBounds.Left;
int topMargin = e.MarginBounds.Top;
e.Graphics.DrawString(textToPrint, printFont,
Brushes.Black, leftMargin, topMargin);
}
}

GeneralRe: Printing from a webservice Pin
Heath Stewart17-Feb-04 13:13
protectorHeath Stewart17-Feb-04 13:13 
GeneralRe: Printing from a webservice Pin
nathanreynolds17-Feb-04 16:27
nathanreynolds17-Feb-04 16:27 
GeneralRe: Printing from a webservice Pin
Heath Stewart17-Feb-04 19:32
protectorHeath Stewart17-Feb-04 19:32 
GeneralRe: Printing from a webservice Pin
nathanreynolds18-Feb-04 2:27
nathanreynolds18-Feb-04 2:27 
GeneralRe: Printing from a webservice Pin
Heath Stewart18-Feb-04 4:11
protectorHeath Stewart18-Feb-04 4:11 
GeneralA GDI+ newbie problem Pin
cemlouis16-Feb-04 11:28
cemlouis16-Feb-04 11:28 
GeneralRe: A GDI+ newbie problem Pin
Charlie Williams16-Feb-04 16:14
Charlie Williams16-Feb-04 16:14 
GeneralRe: A GDI+ newbie problem Pin
cemlouis17-Feb-04 3:50
cemlouis17-Feb-04 3:50 
GeneralFill 50% of a drawing with a color Pin
r916-Feb-04 9:32
r916-Feb-04 9:32 
GeneralRe: Fill 50% of a drawing with a color Pin
Heath Stewart16-Feb-04 9:45
protectorHeath Stewart16-Feb-04 9:45 
GeneralRe: Fill 50% of a drawing with a color Pin
r916-Feb-04 9:48
r916-Feb-04 9:48 
GeneralRe: Fill 50% of a drawing with a color Pin
Heath Stewart16-Feb-04 10:25
protectorHeath Stewart16-Feb-04 10:25 
GeneralRe: Fill 50% of a drawing with a color Pin
je_gonzalez16-Feb-04 12:54
je_gonzalez16-Feb-04 12:54 
QuestionHow to referenc functions in other code file Pin
klufy16-Feb-04 8:28
klufy16-Feb-04 8:28 
AnswerRe: How to referenc functions in other code file Pin
Colin Angus Mackay16-Feb-04 8:57
Colin Angus Mackay16-Feb-04 8:57 
GeneralRe: How to referenc functions in other code file Pin
klufy16-Feb-04 9:29
klufy16-Feb-04 9:29 
GeneralRe: How to referenc functions in other code file Pin
Colin Angus Mackay16-Feb-04 9:42
Colin Angus Mackay16-Feb-04 9:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.