|
I had to check, you are obviously new to CP, so read the guidlines, decide wether this is a forum you want to use as your development LEARNING resource.
From this question I do not expect to see you here again, except possibly to trade insults because we will not send you the code.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have a Problem in Printing Receipt using EPSION DotMatrix Printer using C# program. The Report has been designed in CrystalReport11-R2. My papers size is Heigth:10 inch Width:9.5 Inch.
Printing single page is ok, but when i print morethan one page at once datas are printed in unrequired location.
So, I want to ask which paper setting should be done for my paper and how?
In short, How can i Print receipt in continuous sheet paper having height 10 inch and Width 9.5 inch using EPSION Dot Matrix Printer using C# code?
Please Help Me:
|
|
|
|
|
Hello friends I want to call a function on pressing Ctrl+S button.
how can I do this?
Thanking in Advance
S.N.ALam
|
|
|
|
|
In a Winforms application? I'd make a Menu item and set Ctrl+S as the hot key.
(Or I could be completely wrong; I ate a handfull of chocolate-covered espresso beans.)
|
|
|
|
|
Just listen for the KeyPress event of the form (if it's in fact a WinForm application). When the key, or the key combination, is pressed just run your method. For instance:
this.KeyPress += new System.Windows.Forms.KeyEventHandler(this.MyApp_KeyPress);
private void MyApp_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.F5)
{
this.MyMethod();
return;
}
}
private void MyMethod()
{
MessageBox.Show("MyMethod");
}
|
|
|
|
|
Hey,
I got a project to make an video application (that I can see myself on windows form).
The problem is that I dont know how to do that kind of things, so I searched the net and found the WIA COM and thinking of using it.
I found that article: WIA Scripting and .NET[^]
But for some reason my computter says that the COM "WIALib" not exists... so I continued search and found that:
http://www.codeguru.com/forum/showthread.php?t=439027[^]
But for some reason, the line
CommonDialogClass class1 = new CommonDialogClass();
Gives me an problem
Error 2 Interop type 'WIA.CommonDialogClass' cannot be embedded. Use the applicable interface instead. C:\Users\Yahav\Documents\Visual Studio 2010\Projects\ControlCamera\ControlCamera\Form1.cs 69 40 ControlCamera
and the same for that:
DeviceManager manager = new DeviceManagerClass();
Someone can explain me why?
Thank you very very moch! Yahav.
Gindi Bar Yahav - Web & Software developer.
|
|
|
|
|
|
hello i cant understand it all can u explain ....
WIA.CommonDialog Class' cannot be embedded. Use the applicable interface instead.
please ..
|
|
|
|
|
In the properties of assembly,
Change "Embed Interop Types" To 'False'
|
|
|
|
|
Hi all, I am trying to use SQLite database for my App. It seems like I can insert datetime into datetime column.
Does anyone know how to do this.
thanks in advance.
|
|
|
|
|
If you use a parameterised query, it will take care of any data type conversion for you. What have you tried ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
purpose
I am implementing a singleton "message queue". Several threads will enqueue messages to this queue and the worker thread will dequeue messages and process the message.
problem
in the line: "instance.threadWorker = new Thread(new ThreadStart(MessageWorker));" causes the error...
"An object reference is required for the non-static field, method, or property 'Application_Messaging.class_MessageQueue.MessageWorker()'"
code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
#pragma warning disable 0628 //suppress "new protected member declared in sealed class"
namespace Application_Messaging
{
public sealed class class_MessageQueue
{
private static class_MessageQueue instance = null;
private static readonly object padlock = new object();
private Thread threadWorker;
protected class_MessageQueue()
{
}
public static class_MessageQueue Instance
{
get
{
lock (padlock)
{
if (instance==null)
{
instance = new class_MessageQueue();
instance.threadWorker = new Thread(new ThreadStart(MessageWorker));
instance.threadWorker.Start();
}
return instance;
}
}
}
private void MessageWorker()
{
}
}
}
how can I get the worker thread running ?
|
|
|
|
|
Should the thread be spun off in the constructor?
And why have the constructor protected rather than private?
|
|
|
|
|
"protected" is how Microsoft showed the singleton pattern on MSDN
|
|
|
|
|
I bet they didn't seal it though.
|
|
|
|
|
A static constructor/method/property cannot access any non-static members in its class; that includes both data members and code members (constructors/methods/properties).
==> make MessageWorker() a static method.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
|
PIEBALDconsult wrote: Is that a good idea?
This[^] seems to suggest it isn't; and I wouldn't make the queue neither static nor singleton myself, however it was my attempt to answer the question in general, allowing the OP to get the code to compile.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
My original intent in creating the message queue as a singleton was purely for good design. Now I'll rework the class and simply ensure that the class isn't instantiated more than once.
|
|
|
|
|
Most often when I create a class, even when I only need one instance of it right away, sooner or later a bigger app will want to have more than one instance, so static and singleton aren't the right approach then. It is very seldom you can be sure you will never want more than one instance of anything.
In your case, whatever you have now, you may end up wanting it all duplicated:another queue, another bunch of threads filling the queue, another backgroundworker emptying the queue. So why build in that restriction in the first place?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
abiemann wrote: a singleton was purely for good design
I agree with Luc. Singletons are rarely a good design.
|
|
|
|
|
I just need a quick answer to this question.
If I have a custom class that implements IDisposable, in my void Dispose(){}; function whats supposed to go in there? Do I null all the resources I am using?
Any help would be appreciated.
|
|
|
|
|
There are many good articles at codeproject about the IDisposable pattern. I strongly suggest you read them
|
|
|
|
|
|
Whatever you want; it doesn't need to do anything if there's nothing to do.
I tend to empty collections there.
|
|
|
|