|
....
if (string.IsNullOrEmpty(AcrobatReaderPath))
{
AcrobatReaderPath = @"C:\Programme\Adobe\Reader 8.0\Reader\AcroRd32.exe";
}
logger.Info("AcrobatReaderPath = " + AcrobatReaderPath);
System.Diagnostics.ProcessStartInfo startInfo = new ProcessStartInfo();
logger.Info("1");
startInfo.Arguments = "/h /t \"" + pdfFileName + "\" \"" + printerName + "\"";
logger.Info("2");
startInfo.FileName = AcrobatReaderPath;
logger.Info("3");
startInfo.UseShellExecute = true;
logger.Info("4");
startInfo.CreateNoWindow = true;
logger.Info("5");
startInfo.RedirectStandardOutput = false;
logger.Info("6");
startInfo.UseShellExecute = false;
logger.Info("7");
System.Diagnostics.Process process = Process.Start(startInfo);
logger.Info("8");
....
I checked the acrobat path, it is correct. I checked the pdfFileName path, it is correct. I also checked the printername and this is correct as well.
But when starting the process it throws the error message.
What the code does: it prints a pdf file (located on harddisk) using the specified printer.
As I said in my first posting, I tried it on different systems, there are some it works fine (no error message) but there are some which cause this message. And I have no clue why.
the logging works well, so this should not be the problem!
Stephan.
|
|
|
|
|
the command which you are given , check that command manually whether it prints or not,
Break your problem i 2-3 steps.
First check whether acro reader is opening your file or not , if yes then check the full problem.
|
|
|
|
|
i already did this, and it works.
but it does not work the way i programmed it.
i will try to start just adobe and proceed step by step, maybe I will stumble into this error.
|
|
|
|
|
strange, the error is gone now, but this process should start the printing on the specified printer, but the program finishes with returncode ok but the file never reaches the printer.
does this mean the processcall here doesn't throw any exception anymore but it doesn't really do what it should have done?
does anyone of you have an idea?
Stephan.
|
|
|
|
|
when i set the process to start acrobate then it does, but it does not send the file to printer, as it is intended to.
is there a way to debug this (meaning the process) to see, why no file is received by the printer queue?
|
|
|
|
|
Are you doing a "File.Exist(startInfo.Filename) = True" check before you are starting?
Search for that file on the machine... If there are multiple copies, it may be trying to pull from a directory the %path%.
|
|
|
|
|
Hi,
I got the error message "object reference not set to an instance". Actually i am doing a small program on DataReader then the above said message comes. Please any suggestions..
|
|
|
|
|
It seem that you are referencing an object which is not created.
post your code.
|
|
|
|
|
private void findbutton_Click(object sender, EventArgs e)
{
SqlDataReader rdr = null;
SqlConnection con = null;
SqlCommand cmd = null;
try
{
// Open connection to the database
string ConnectionString = "server=INDUS-SERVER;uid=sa;pwd=victory;database=northwind";
con = new SqlConnection(ConnectionString);
con.Open();
// Set up a command with the given query and associate
// this with the current connection.
string CommandText = "SELECT FirstName, LastName" + "FROM Employees" + "WHERE (LastName LIKE @Find)";
cmd = new SqlCommand(CommandText);
cmd.Connection = con;
// Add LastName to the above defined paramter @Find
cmd.Parameters.Add(
new SqlParameter(
"@Find", // The name of the parameter to map
System.Data.SqlDbType.NVarChar, // SqlDbType values
20, // The width of the parameter
"LastName")); // The name of the source column
// Fill the parameter with the value retrieved
// from the text field
cmd.Parameters["@Find"].Value = txtFind.Text;
// Execute the query
rdr = cmd.ExecuteReader();
// Fill the list box with the values retrieved
lblFound.Items.Clear();
while (rdr.Read())
{
lblFound.Items.Add(rdr["FirstName"].ToString() + " " + rdr["LastName"].ToString());
}
}
catch (Exception ex)
{
// Print error message
MessageBox.Show(ex.Message);
}
finally
{
// Close data reader object and database connection
if (rdr != null)
rdr.Close();
if (con.State == ConnectionState.Open)
con.Close();
}
|
|
|
|
|
hi
Well there are couple of things that you are not doing right in your code. Your comments are interfering with your code. Your code is creaming "Put me inside a Function"
You have used unnecessary things in your code. if you can try to write your code like this
public SqlDataReader GetData()
{
SqlDataReader rd;
SqlConnection con;
SqlCommand cmd = new SqlCommand();
string ConnectionString = "server=INDUS-SERVER;uid=sa;pwd=victory;database=northwind";
con = new SqlConnection(ConnectionString);
cmd.CommandText = "SELECT FirstName, LastName" + "FROM Employees" + "WHERE (LastName LIKE @Find)";
cmd.Connection = con;
cmd.Parameters.Add(new SqlParameter("@Find", SqlDbType.NVarChar, 20, "LastName"));
cmd.Parameters["@Find"].Value = txtFind.Text;
try
{
con.Open();
rd = cmd.ExecuteReader();
rd.Close();
con.Close();
}
catch (SqlException e)
{
Messagebox.show(e.Message);
}
return rd;
}
}
}
Now things are Better, because Previously you just opened the Connection where you were not supposed to, remember that you have to connect to the Database when you want to execute something. after you are done you close it, and now this function returns a reader, then you can iterate through your records or your can just choose to send the data into the datatable and bind the control.
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Stil i'm getting error..i will do one thing just i will paste all the code.please resolve it...
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace DataReaderWith2Tables
{
public partial class Form1 : Form
{
private System.Windows.Forms.ListBox lblFound = null;
private System.Windows.Forms.Button findButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtFind = null;
//private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void findbutton_Click(object sender, EventArgs e)
{
SqlDataReader rdr;
SqlConnection con;
SqlCommand cmd = new SqlCommand();
string ConnectionString = "server=INDUS-SERVER;uid=sa;pwd=victory;database=northwind";
con = new SqlConnection(ConnectionString);
cmd.CommandText = "SELECT FirstName, LastName" + "FROM Employees" + "WHERE (LastName LIKE @Find)";
cmd.Connection = con;
cmd.Parameters.Add(new SqlParameter("@Find", System.Data.SqlDbType.NVarChar, 20, "LastName"));
cmd.Parameters["@Find"].Value = txtFind.Text;
try
{
con.Open();
rdr = cmd.ExecuteReader();
rdr.Close();
con.Close();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
return rdr;
}
}
}
|
|
|
|
|
I think you are closing the rdr (rdr.Close()) in try block and then you are trying to return rdr (return rdr). Please check it.
|
|
|
|
|
i'm trying on an application in which i want the user to move the components on the form.(a checker game , the player should move the object on the board)could any one suggest me on this . thank you!
|
|
|
|
|
When the mouse left button is clicked then start moving and when right mouse button is clicked then stop moving. This is a varibale.
Now on mouse move event if start moving is true then capture the mouse position and assign the location value to mouse current point. at the end call invalidate() Fn.
Be Happy
Syed Shahid Hussain
|
|
|
|
|
thanks for your reply,got the idea,is there any references which can be used...
|
|
|
|
|
How can i change the size of a textbox(Which exists on the window) while resizing the window size?
Thank you
|
|
|
|
|
Use Anchor property for that textbox.
|
|
|
|
|
Hi,
can you guys help me out .. what exactly i need to install, i wanted to connect Oracle server 7.3.4 with OLEDB interface?
regards
ranganadh kodali
Kodali
|
|
|
|
|
Hi! I have this application what I build and I want to put automatic updates for the application so the user will have the latest version of the application. I found in the properties menu, the publish tab, where it says about automatic updates and publish the application. So now I want to add a button to the application, so when the user will click the button it will check for the latest version and if there is a version newer then the one they are using in the moment, the app will be updated to the latest version. Any help with this how I can solve? Thanks ahead
|
|
|
|
|
Please google search for ClickOnce deployment type. In ClickOnce the application checks for updates as soon as it is started so that ensuring the usage of latest version.
Regards,
|
|
|
|
|
I used below project source code to make MHT,
http://www.codeproject.com/KB/files/MhtBuilder.aspx[^]
Below strings are problem.
1:
"<link[^>]+?href\s*=\s*(?<key>('|"")*(?<value>[^'"">]+)('|"")*)"
2:
"<i*frame[^>]+?src\s*=\s*(?<key>['""]{0,1}(?<value>[^'""\\>]+)['""]{0,1})"
3:
"(?<attrib>@import\s|\S+-image:|background \s*?(url)*['""(]{1,2}" & _
"(?!http)\s*/(?<url>[^""')]+)['"")]{1,2}"
In some links it takes between 2 and 10 minutes. it usually happens in external links.
WHY?
Thanx...
I want to fly but I don't have wings
modified on Wednesday, August 6, 2008 6:44 AM
|
|
|
|
|
I don't know, but I suspect the doubled-quotes, try \" instead.
For getting hrefs I use:
"href\\s*=\\s*(?'quot'[\"'])(?'href'.*?)((?'sep'#)(?'id'.*?))?\\k'quot'"
|
|
|
|
|
|
yes sir, I solved click problem in vb code
I didn't use cssPattern in regex and it works fast and I have no any problems on clicks...
Only one problem left. CSS
I want to fly but I don't have wings
modified on Wednesday, August 6, 2008 6:44 AM
|
|
|
|
|
Hi,
i am using DataGridView, kindly let me know or give me examples link that how may I get row ID from KeyPress event?
Thanks in advance
(Riaz)
modified on Tuesday, August 5, 2008 2:31 AM
|
|
|
|