|
You can take screenshots by using the method that draws the form onto a graphics object, then build an image to print.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
There are several examples of printing code on this site. Did you perform any kind of search before posting your question?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
It would be nice if you directed me to them
Ferron
|
|
|
|
|
No, it would be pandering to your laziness.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I created an activex com object and would like to create an instance in a c# form. when adding the component with the wizard it creates a new instance with "new" end every C# exe gets its one inctance. I am looking for the equivalent C# whay to CoCreate: create the com object only if not exists, get the currantly active instance otherwise. I think the solution lies somware in interop services but failed to find a solution so far....
|
|
|
|
|
C# doesn't have an equivalent to CoCreate, its all hidden behind the interop wrapper. You just have to create an instance of the object in question. If you want a single instance of this object then you need to use a Singleton pattern.
only two letters away from being an asset
|
|
|
|
|
hi friends,
i have read the Stream of the webpage code is
String page = "http://www.google.com";
HttpWebRequest site = (HttpWebRequest)WebRequest.Create(page);
HttpWebResponse response = (HttpWebResponse)site.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader read = new StreamReader(dataStream);
String data = read.ReadToEnd();
Now i need to Get the Href of all the images used in this Webpage so that i can download it one by one how can i serach Href and get the link out of it.
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
You probably want to use a regular expression to get the <a> tags in the page and then strip the href out of them.
|
|
|
|
|
See this[^] article
*jaans
|
|
|
|
|
Gents,
I have the following problem that drives me insane. I've written a service that runs in the background. However, I can't get the DateTime format right. I must have tried everything to get it right, but to no avail. When the service starts or stops, it will tell me by writing to a log file. The output of the log file looks like this :
1/19/2009 1:48:40 PM Manager: Service Stopped<br />
1/19/2009 1:48:43 PM Manager: Service Started<br />
1/19/2009 2:17:05 PM Manager: Service Stopped<br />
1/19/2009 2:17:29 PM Manager: Service Started<br />
1/19/2009 2:18:02 PM Manager: Service Stopped<br />
1/19/2009 2:20:27 PM Manager: Service Started
Now .. When it writes to the logfile, it uses the above format for DateTime.Now , while I want to use "dd-mm-yyyy HH:mm:ss"
I set the regional setting in Control Panel as well as the Date and Time format. It shows up perfect in my system clock. It still spits out the above to the logfile. Then I tried the following in my code, so set it programmatically :
static void Main()
{
CultureInfo newCulture = new CultureInfo("en-US", false);
newCulture.DateTimeFormat.FullDateTimePattern = "dd-mm-yyyy HH:mm:ss";
System.Threading.Thread.CurrentThread.CurrentCulture = newCulture;
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new RealTime() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
That didn't fix it .. still the same output.
When I put a MessageBox in between somewhere to let me show DateTime.Now.ToString() , it also comes back with 1/19/2009 2:20:27 PM. Some of the methods in the service report an invalid <code>DateTime</code> conversion when I try the following code :
DateTime time = Convert.ToDateTime("19-01-2009 13:12:56");
It drives me insane. Can please someone point me in the right direction ?
Kind regards,
|
|
|
|
|
You can try this line:
DateTime.Now.ToString("MMM dd,yy HH:mm:ss", CultureInfo.InvariantCulture)
I think it will solve your problem
|
|
|
|
|
Thank you for your feedback,
it does indeed fix half of my problem. I can get the date right in the logfile, however .. it will not fix the below calculation :
DateTime lastTime = Convert.ToDateTime(dt.Rows[lastRow]["date"].ToString());
Where the value in the DataTable is "19-01-2009 13:45:59", the error is :
1/19/2009 4:34:24 PM System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.DateTime.Parse(String s, IFormatProvider provider)
at System.Convert.ToDateTime(String value)
at Loudnixx_RealTime.RealTimeRadar.ExceedTrackTime()
at Loudnixx_RealTime.RealTimeRadar.ProcessString(String dat)
at Loudnixx_RealTime.RealTimeRadar.Listen()
Somehow there has to be a way to set it globally throughout the program.
Can you point me in the right direction ?
kind regards,
|
|
|
|
|
It looks like a different date format: 1/1/2008 as pose to 1-1-2008 and in any case you can manipulate only on the strings.....
|
|
|
|
|
Is dt.Rows[lastRow]["date"] already a DateTime? If yes, don't convert it into a string again. For converting DateTimes to strings, use DateTime.ToString(formatString).
For parsing strings into DateTimes, use DateTime.ParseExact[^]
Cheers,
Vıkram.
I don't suffer from insanity, I enjoy every moment of it.
|
|
|
|
|
Thank you all for your reply
DateTime lastTime = DateTime.ParseExact(dt.Rows[lastRow]["date"].ToString(),"dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture);
did the trick
Once again, thank you
kind regards,
|
|
|
|
|
Like I said, if dt.Rows[lastRow]["date"] is already a DateTime, you just have to assign it to lastTime. If it's not, remove the extra ToString().
You are welcome Also, if you think somebody helped you, please vote them a 5. It's a small pleasure
Cheers,
Vıkram.
I don't suffer from insanity, I enjoy every moment of it.
|
|
|
|
|
Hey,
I need to write to a virtual com port......
I'm totally new to this field and do not have any idea what virtual com port is all about?
Can anybody please enlighten me on this ?
Also let me know, in the first place, if it is possible to read/write to a virtual com port ?
Thanking you in anticipation
Regards......
|
|
|
|
|
you need to do device driver for virtual com port , also it is possible to read and write to virtual com port , writing and reading from a virtual com port would be same as reading and writing on a physical com port , but making a virtual com port will take some efforts , you need to learn Device drivers
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Bharat Jain wrote: you need to do device driver for virtual com port , also it is possible to read and write to virtual com port , writing and reading from a virtual com port would be same as reading and writing on a physical com port , but making a virtual com port will take some efforts , you need to learn Device drivers
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
Thanks Bharat for a quick reply......
I will definitely go through device drivers......
But in the time being if you can give some more valuable input, then it would be a great help
Kindly suggest what I need to do programatically ?
May be you can tell me the procedure and give some sample C# code if at all possible
Looking forward to your help......
Thank you
|
|
|
|
|
Drivers are written in C or occasionally C++. Managed code (eg C#) need not apply.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
dan neely wrote: Drivers are written in C or occasionally C++. Managed code (eg C#) need not apply
Does this mean, writing to a virtual com port is not possible in C# ?
Can you please elaborate ?
|
|
|
|
|
0 YOU CANNOT WRITE DRIVERS IN MANAGED CODE.
1 C# IS MANAGED CODE
2 IF YOU HAVE TO ASK QUESTIONS THIS BASIC YOU'RE NEVER GOING TO BE ABLE TO WRITE A WORKING DRIVER BECAUSE DRIVER BUGS CRASH THE OS AND FORCE A REBOOT EACH TIME SOMETHING GOES BOOM.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
dan neely wrote: 0 YOU CANNOT WRITE DRIVERS IN MANAGED CODE.
1 C# IS MANAGED CODE
2 IF YOU HAVE TO ASK QUESTIONS THIS BASIC YOU'RE NEVER GOING TO BE ABLE TO WRITE A WORKING DRIVER BECAUSE DRIVER BUGS CRASH THE OS AND FORCE A REBOOT EACH TIME SOMETHING GOES BOOM.
Hey Dan,
Thanks for the reply......
I just needed to confirm whether the drivers can be written in C# somehow. I never had a question whether C# is managed or not......
I understand the complications involved in writing drivers, and so I wish you help me through......
Thanks for confirming that writing drivers in C# is not possible......
Can you please guide me in writing device drivers, may be, in C++ ?
Regards......
|
|
|
|
|
queries365 wrote: I need to write to a virtual com port
why? can you provide more contextual information?
Luc Pattyn [Forum Guidelines] [My Articles]
I use ListBoxes for line-oriented text output (not TextBoxes), and PictureBoxes for pictures (not drawings).
modified on Friday, June 10, 2011 12:13 PM
|
|
|
|
|
Luc Pattyn wrote: why? can you provide more contextual information?
Hey Luc,
I have a device connected in the USB port. I want to write data received from it to virtual com port. I want to do this in C#.
Is it possible and if yes can you please guide me through ?
Regards......
|
|
|
|