|
I havent had any printing problems, except for the fact that some details are strange at least (where and when to set properties in order to choose color, landscape, duplex...).
But I strongly suggest you throughly process any exception; rather than looking at
exc.Message, you really should look at the multi-line exc.ToString()
it gives you, depending on the kind of exception, much more information, and also
a stack trace, so you can tell in exactly what line things fail.
Good luck !
Luc Pattyn
|
|
|
|
|
try to comment pagesetupdialog object and just try working around with objects printpreviewdialog and printdocument
printPriewdialog ppd = new printpreviewdialog();
ppd.document=pd;
ppd.showDialog();
|
|
|
|
|
Thanks for the reply! If I don't use a PageSetupDialog the problem persists when I actually try to print. Just like before sometimes the document prints and sometimes I get exceptions.
TIA
|
|
|
|
|
I'm still getting exceptions, which actually come from the ShowDialog command. The document is rendered correctly, but if I try to print from the print preview dialog I get an exception.
Thanks in advance for any help on the subject!
|
|
|
|
|
For what it's worth, I think this is a bug somewhere in Microsoft's code. Even if I use the sample code provided on the Microsoft website (http://msdn2.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx) I still get invalid handle exceptions!
|
|
|
|
|
Well, your previous post triggered my memory:
When I earlier said I did not have any printing problems, I was forgotten that I once
had major problems, if clicking the Prin button in the Preview Dialog.
This occurred some 2 years ago, when I added printing capabilities to my major application,
using either .NET 1.0 or 1.1 (without SP), I dont recall.
Since then I have been using my app and have printed and previewed hundreds of pages.
I do not recall what the exact problems were, but I concluded not to use that Print button
anymore.
I should also add I had some dificulties in understanding (or getting to work without
understanding) the printer settings regarding:
- page orientation
- color support
- duplex printing
And finally I have always been puzzled how one is supposed to do a Print Preview without
selecting a printer (with its margins, page orientation, etc). I would find it simpler
to have a print dialog with its normal choices, and both a Preview and a Print button.
Following your input I just finished a couple of experiments, and was unable to make
the Print Button on Print Preview Dialog fail; I have tried .NET 1.1 WITH SP1, as well as
NET 2.0 So maybe there has been a bug and it got fixed either in SP1 or in 2.0
What is your .NET version ? and the one your bug info refers to ?
Luc Pattyn
|
|
|
|
|
My .NET version is 2.0. I'm not sure what you mean when you ask "the one your bug info refers to", as I assume it would be the same. Can you elaborate if this isn't the information your looking for!
Thanks!
|
|
|
|
|
I was under the impression you had found a bug report.
Since you are using 2.0 I can't guess what's happening.
Could you try with different printers, and/or PDF writers, faxes ?
do they all show the same problem ?
BTW: I am actually preparing an article on a control to ease control previewing and
printing, so in another week or so, I will publish a program that works fine on my system,
and that you then could test on yours.
Luc Pattyn
|
|
|
|
|
I find it almost impossible to find any information on the Adobe site, so I thought I'd ask and see if anyone can clarify this issue.
In our software we want to use the adobe reader component embedded in a form to display a pdf. I found on the adobe site the licensing agreement for distributing adobe reader, but if we do not distribute it but only use the control and the user of our software either already has adobe reader or goes to the site and downloads it themself - are we allowed to do that or is there some agreement or conditions? I'm fairly certain that the control does not work unless the person has adobe reader already installed so it is not like we are actually distributing anything of adobe's at all.
I think I saw something at least hinting at the answer if not outright stating it, but I can't find it now!
ps. I know this is not strictly c# question, but I wasn't sure what forum to ask in.
"Your typical day is full of moments where you ask for a cup of coffee and someone hands you a bag of nails." - Scott Adams
|
|
|
|
|
FYI, you can view PDF files (as well as office documents and HTML files) using
AxSHDocVw.AxWebBrowser, which is, AFAIK the way Internet Explorer does the same.
Doing it that way you dont have to add anything to your PC...
Luc Pattyn
|
|
|
|
|
Hello, I'm asking yet another question to all of you geniuses.
I've gotten nearly every function working in the program I'm developing for work. The one thing I'm missing, however, is the ability to run commands on remote computers.
At first, I was hoping there was some .NET function to do this easily (you can start and stop services, so why not apps?) However, it does not appear so. Perhaps I missed one.
My next guess was to try to start telnet, and try to use SendKeys.Send() to send my commands... however, the commands pass into my Command Prompt before telnet finishes connecting.
The actual problem is that i'm hoping for a .NET managed way to run remote commands. A workaround for telnet like that would be usable, but only as a last-hope sort of thing. If possible, perhaps there is a .NET managed way to perform the task without running DOS commands remotely? This is what I'm trying to do:
RemoteComputer comp = new RemoteComputer("Target");
comp.Run("wuauclt.exe /resetauthorization");
comp.Run("wuauclt.exe /detectnow");
I'm simply trying to get the remote computer's Windows Update Agent to reset authorization, and then detect updates.
Thanks in advance to any of you who can help.
|
|
|
|
|
I suspect you need to have a program installed on the target computer, which you can communicate with. Otherwise, Windows would have no security at all, right ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Well, the security is not an issue.
Whatever the method I try to utilize, my account has Administrator rights on all of the target computers....... but perhaps I can work on the "Install a Program" idea.
Can anyone teach me about making a pushing services? I only know how to Start and Stop them remotely.
edit:
Actually, i found a great tutorial on how to make basic services. Cool.
-- modified at 18:24 Wednesday 17th January, 2007
|
|
|
|
|
How do you select the row that has the ">" pointer on it on the DataGridView? I guess i am looking for the current row or the active row or the row that has focus.
|
|
|
|
|
I have a datagridview bound to a datatable. One varchar column is visible and the datagridview automatically creates a tooltip for the entire column's data when it does not fit in the current column width. How to I access the underlying tooltip so I can adjust the time the tooltip is displayed? Actually, I would like to force the tooltip to remain visible while the mouse is pointing to a row in that one column datagridview.
Thanks for you help and suggestions.
Steve
|
|
|
|
|
Hi,
Im trying to clarify whats the best method to join columns from 2 datatables which have a relation into one DataGridView.
Example:
Customers Table:
id
name
id_country
Countrys:
id
name
Then I have them linked using DataRelation and my DataGridView points to the Customers Table, datagrid wizard shows only fields from Customers Table and the only way I know to add them to the view is changing the select query of the DataAdaptor doing a join like:
Select customer.id,customer.name,customer.id_country,countrys.name FROM customer,country WHERE customer.id_country=country.id;
or using the inner join...
But is there a better way in C# to do it without changing the main query of the dataapapter, i saw something called Child() in Expressions , but was imposible to put it working.
Thanx in advance,
|
|
|
|
|
Hi all,
I am trying to change the size of label control but its not changing. I am trying to change it within form aswell as by changing it from property, but its not working. It gets back to its same small size.
This problem is in VS2005, whereas when i try in VS2003 it works fine.
Is there anything i can do for this matter ?
Thanks
|
|
|
|
|
Is the AutoSize property set to true ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I'm building a Control descendant that overrides OnPaint() to draw itself according to its Enabled state; and I've overridden OnEnabledChanged() to call Invalidate(). However, when setting Enabled, OnEnabledChanged() is never called. What am I doing wrong?
TIA,
m
|
|
|
|
|
Hi fellow C#-ers
I have a question, hope there's someone out there that might give me a possible solution to this issue.
Basically I'm trying to parse a string (the query string) to my returnResults method which in turn returns a DataSet object. What I'm trying to achieve is to strip down the query string and work with a certain number of character which in turn will be parsed to my SqlDataAdapter to provide it with the table name.
So, let’s say my query string looks like this:
<br />
SELECT * FROM Product<br />
All I basically need is the table name, in this case "Product".
How is it possible to only strip the string of the character "Product" ?
<br />
<br />
public DataSet returnResults(string query)<br />
{<br />
SqlDataAdapter sqlDA = null;<br />
DataSet ds = null;<br />
StringBuilder str = new StringBuilder();<br />
string tableName = null;<br />
<br />
str.Insert(0, query);<br />
<br />
tableName = str.<br />
<br />
<br />
return ds;<br />
}<br />
<br />
Your feedback will be much appreciated.
Thanks!
R
|
|
|
|
|
You can use a regex that looks for the word 'FROM' and then grabs the word after it. You could even find that with string mashing
It's a shame your code is dealing with SQL this directly
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi Chistian,
Thank you for your response.
I also would like to have your ideas when you said
Christian Graus wrote: It's a shame your code is dealing with SQL this directly
What are your recommendations? I'm open and flexible to advice and ideas.
Thanks.
R
|
|
|
|
|
I always like to see the data layer confined to stored procedures.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
there are basically two ways:
1)
string operations
there is String.IndexOf(str) to locate a substring,
String.Substring(start, length) to take a substring,
String.Trim() to remove white space at start and end,
and String.Split(separator, times) to split a string by a separator
In your case, I would try something like:
int i=s.IndexOf(" FROM ");
s=s.Substring(i+5);
string[] sa=s.Split(' ', 2);
s=sa[0].Trim();
alternatively you could split first, then search which array element contains FROM
and use the next array element. Or just assume it always must be the fourth element...
You should carefully choose your startegy to locate the stuff you need.
2)
regular expressions
very powerful, not very intuitive; in this case I would prefer string operations
Luc Pattyn
|
|
|
|
|
Hi Luc,
Thank you for providing me with a solution.
It makes sense now!
I have to be honest, I haven’t had to deal with string manipulation in a long time.
I appreciate the feedback.
Thanks.
R.
|
|
|
|