|
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.
|
|
|
|
|
i have xml file
iam having c# application
i need to
1-read xml file in c# abd pass it as parameter to sql server store procedure (parameter type xml)
2- use procedure have xml parameter to insert data into table
md_refay
|
|
|
|
|
And what have you tried so far?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I think nothing... Just asked us before starting anything.. .
|
|
|
|
|
I think you need to read books on C# before you start. Reading and passing XML data to procedure is pretty easy. Just need basic knowledge on Database types and create XML.
For quick knowledge, you might consider Linq to XML. Its the easiest.
|
|
|
|
|
Hi there.
I am a beginner at MVP & one question strikes my mind:
isn't it simpler to create methods in Presenter, such as:
Save()
Start()
Stop()
and possible some events to which some view may subscribe.
instead of events in IView interface:
event SavePressed
event StartPressed
event StopPressed
and some methods which a presenter can call.
In this case Presenter is still separated from View level and capable of unit testing.
But also we eliminate the necessity to create IView interface and Presenter doesn't know anything about IView (explicitly, implicitly perhaps it will have to provide dome events such as StateChanged and so on).
thanks,
Ayrat
|
|
|
|
|
|
hi.
i work in Microsoft Visual Studio 2008 . i working in C# enviroment and creat a website project.
i want open picture with open dialog .please tell me who i can load picture with open dialog?
i am beginner .
please explain step to step.
whether i need a componet as toolbar?
please help me.
i need help body.
|
|
|
|