Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
GeneralRe: Stack Overflow Pin
Denis J. González20-May-09 3:48
Denis J. González20-May-09 3:48 
Questiondisabiling of menustrip in a child form i Pin
reddineni19-May-09 20:48
reddineni19-May-09 20:48 
AnswerRe: disabiling of menustrip in a child form i Pin
musefan19-May-09 22:55
musefan19-May-09 22:55 
QuestionUsing Digital Pen (or Optical Pen) in C#. Pin
hdv21219-May-09 18:42
hdv21219-May-09 18:42 
AnswerRe: Using Digital Pen (or Optical Pen) in C#. Pin
Member 39903293-Sep-09 20:59
Member 39903293-Sep-09 20:59 
GeneralRe: Using Digital Pen (or Optical Pen) in C#. Pin
hdv2125-Sep-09 7:57
hdv2125-Sep-09 7:57 
AnswerRe: Using Digital Pen (or Optical Pen) in C#. Pin
barankamali19-Jan-19 18:00
barankamali19-Jan-19 18:00 
Questionwhat are the dependencies or settings required for browser for supporting ManagementObject ? Pin
svt gdwl19-May-09 18:39
svt gdwl19-May-09 18:39 
I Had to cancel the printing given.
For this I had used

Code Snippet: Sandeep Aparajit playing around with the System.Management.Net namespace.

#region CancelPrintJob

/// <summary>
/// Cancel the print job. This functions accepts the job number.
/// An exception will be thrown if access denied.
/// </summary>
/// <param name="printJobID">int: Job number to cancel printing for.</param>
/// <returns>bool: true if cancel successfull, else false.</returns>
public bool CancelPrintJob(int printJobID)
{
// Variable declarations.
bool isActionPerformed = false ;
string searchQuery;
String jobName;
char [] splitArr;
int prntJobID;
ManagementObjectSearcher searchPrintJobs;
ManagementObjectCollection prntJobCollection;
try
{
// Query to get all the queued printer jobs.
searchQuery = "SELECT * FROM Win32_PrintJob" ;
// Create an object using the above query.
searchPrintJobs = new ManagementObjectSearcher(searchQuery);
// Fire the query to get the collection of the printer jobs.
prntJobCollection = searchPrintJobs.Get();

// Look for the job you want to delete/cancel.
foreach (ManagementObject prntJob in prntJobCollection)
{
jobName = prntJob.Properties["Name" ].Value.ToString();
// Job name would be of the format [Printer name], [Job ID]
splitArr = new char [1];
splitArr[0] = Convert.ToChar("," );
// Get the job ID.
prntJobID = Convert.ToInt32(jobName.Split(splitArr)[1]);
// If the Job Id equals the input job Id, then cancel the job.
if (prntJobID == printJobID)
{
// Performs a action similar to the cancel
// operation of windows print console
prntJob.Delete();
isActionPerformed = true ;
break ;
}
}
return isActionPerformed;
}
catch (Exception sysException)
{
// Log the exception.
return false ;
}
}

#endregion CancelPrintJob







The code line prntJob.Delete() is not executing in other PC's which had .Net framework and all other things same as my Syatem.

What may be the problem? Can anyone say something to solve this?
QuestionAsyncCallback and multi threading Pin
yesu prakash19-May-09 18:39
yesu prakash19-May-09 18:39 
GeneralRe: AsyncCallback and multi threading Pin
harold aptroot19-May-09 23:32
harold aptroot19-May-09 23:32 
GeneralRe: AsyncCallback and multi threading Pin
yesu prakash20-May-09 0:44
yesu prakash20-May-09 0:44 
GeneralRe: AsyncCallback and multi threading Pin
harold aptroot20-May-09 1:09
harold aptroot20-May-09 1:09 
AnswerRe: AsyncCallback and multi threading Pin
Luc Pattyn20-May-09 2:47
sitebuilderLuc Pattyn20-May-09 2:47 
GeneralRe: AsyncCallback and multi threading Pin
yesu prakash20-May-09 3:25
yesu prakash20-May-09 3:25 
GeneralRe: AsyncCallback and multi threading Pin
Luc Pattyn20-May-09 3:45
sitebuilderLuc Pattyn20-May-09 3:45 
QuestionC# and Microsoft OutLook Express 6.0 Pin
nidi26119-May-09 18:10
nidi26119-May-09 18:10 
AnswerRe: C# and Microsoft OutLook Express 6.0 Pin
rakesh_aravindrsa19-May-09 18:38
rakesh_aravindrsa19-May-09 18:38 
GeneralRe: C# and Microsoft OutLook Express 6.0 Pin
Mycroft Holmes19-May-09 19:07
professionalMycroft Holmes19-May-09 19:07 
GeneralRe: C# and Microsoft OutLook Express 6.0 Pin
Roger Wright19-May-09 22:04
professionalRoger Wright19-May-09 22:04 
GeneralRe: C# and Microsoft OutLook Express 6.0 Pin
Mycroft Holmes19-May-09 23:15
professionalMycroft Holmes19-May-09 23:15 
GeneralRe: C# and Microsoft OutLook Express 6.0 Pin
Luc Pattyn20-May-09 2:49
sitebuilderLuc Pattyn20-May-09 2:49 
QuestionGeocoding Pin
shraddha IT19-May-09 18:06
shraddha IT19-May-09 18:06 
AnswerRe: Geocoding Pin
Dave Kreskowiak20-May-09 2:11
mveDave Kreskowiak20-May-09 2:11 
QuestionMultithreading is faster? Pin
Quake2Player19-May-09 17:53
Quake2Player19-May-09 17:53 
AnswerRe: Multithreading is faster? Pin
mav.northwind19-May-09 18:43
mav.northwind19-May-09 18:43 

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.