have a look at the Process and ProcessStartInfo classes, and use Verb="Print"; that way
your default PDF reader will do the actual printing. AFAIK that is the easiest way.
There is one disadvantage: the PDF reader will remain open (unless you add more code to close it,
which is a bit tricky).
this code is running on the server, it attempts to print on the server.
I doubt that is what you want.
Your browser should allow you to print a loaded page (or PDF document) on the client side,
either an interactive browser (IE7, FF, ...) or a programmable one (WebBrowser) or a
program using WebRequest and GetResponse.
correct - I want the print dialog box to appear on the client side. And yes, I am able to print from the loaded page, but the client would like the print dialog box to appear immediately after the pdf loads. Why, I don't know .
I'm developing a USB device that is communicating with a C# program through a serial port interface.
I identify my device using SetupDiGetDeviceRegistryProperty, reading the HardwareId and searching for my VID and PID in the string that is returned. (Don't know if this is the fastest/best way, but it works...)
For the communication I would like to use a SerialPort component so I need to get the COM port used by my device but I can't find that information using SetupDiGetDeviceRegistryProperty.
Using the Device manager the information is available under Properties/Port Settings/Advanced/Com port number and in the registry it can be found at HKLM\Hardware\DeviceMap\SerialComm but how do I access that information from my C# code?
I was looking for a way to dynacmicly open a form and realize that the best way will be to use reflection.
It is the first time i am using reflection and think that i am alomost there but it still doesnt work.
i am getting a message "Object does not match target type."
Bellow is the code.
Type theType = Type.GetType("WindowsFormsApplication1.Form2");
MethodInfo method = (from met in theType.GetMethods()
where met.Name == "Show"
If you only know the name as a string, did you get it from reflection ( that is, are you on a bizarre quest to write code that will open any form from any dll ), or is it from a known list ? As someone else said, in the latter case, a Factory pattern is what you want.
No longer a Microsoft MVP, but still happy to answer your questions.
Writing a project for a client using .NET 3.5 in C#. I need to import data from an XLS spreadsheet into a SQL data table. Problem is, one of the columns in the date table contains an "optional" date field. In the sample file provided by the client, no data exists in that optional field until row 27. The result is that NO ROW contains the optional field in the final SQL table.
I've been using an ODBC connection (MS Jet 4.0) to read the XLS. I tried adding MAXSCANROWS=0, which according to what I've read should allow the first 16384 rows to be used in determining column types. However, this seemed to have no effect.
I read another article that suggested the work-around is registry editing. That's not too practical, especially for deploying this project to the client's server.
Does anyone know another way to get the data to import correctly?
I've had nightmares trying exactly this kind of thing in Excel. That and the fact that if someone has the file open ODBC doesn't revert to a readonly mode as would happen if 2 people opened an xls file in the conventional manner.
As i remember if the first populated field within a column contains an integer you then get problems if subsequent fields contain text etc.
I think i ended up using the PIA approach and reading the data out cell by cell. It's slightly more laborious but gives a much finer level of control over what is happening
PIA approach? Can you point me in the direction of an article that would demonstrate how to read out the data cell by cell? I would have preferred this from the start, but I have been unable to find such information.
The primary interop assemblies are provided by microsoft so that you can access the Excel object model in c# code. Off the top of my head I believe that you have to have excel installed on the machine that's doing the processing.
Editing glyph IS NOT the black arrow, showing the row selected! The question is still actual. And I think the solution is to draw in row header. But what exactly? I'm sure somebody had already fixed this issue.
Last Visit: 20-Sep-20 21:35 Last Update: 20-Sep-20 21:35