|
It sounds like your event's being hooked after the initial load (loading of new messages into the inbox folder). Once it's hooked, any new messages are handled properly.
I'm not familiar with this, though. Maybe you can try and change the outlook settings so new messages aren't downloaded until you manually check them? (maybe that would give time for you hook to be in place?). Ideally the hook should happen before the download event.
|
|
|
|
|
Hi,
When I pass Strings as arguments to delegate, it runs perfectly fine.. But when I try to pass String Arrays, it gives error..
So does that mean we cant pass string arrays as parameters to delegates???
Here's a snippet of code:
public: delegate void myDelegate1(String^);<br />
<br />
public: delegate void myDelegate2(array<String^>^);<br />
<br />
<br />
<br />
private: void BasicPolicyMethod()<br />
<br />
{<br />
<br />
String^ str = "Hi";<br />
<br />
array<String^>^ arrstr = gcnew array<String^> {"Hi","Hello"};<br />
<br />
<br />
<br />
this->Invoke(gcnew myDelegate1(this, &DashBoardForm::myMethod1), str);<br />
<br />
<br />
<br />
<br />
<br />
this->Invoke(gcnew myDelegate2(this, &DashBoardForm::myMethod2), arrstr);<br />
<br />
<br />
<br />
private: void myMethod1(String^ str)<br />
<br />
{<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
private: void myMethod2(array<String^>^ arrstr)<br />
<br />
{<br />
<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
Any replies would be appreciated..
Thank you !!
|
|
|
|
|
What language is this? Some bestiality between MS and C++? This is the C# forum.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
I think thats ye olde C++ using the .NET framework. I can't be certain though.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
SK Genius wrote: think thats ye olde C++ using the .NET framework. I can't be certain though.
This is the latest C++/CLI langauge implemented both in Visual Studio 2005 and just released 2008..
Only the syntax is a bit different..
I dont think one would have many problems if he knows C#..
How can we pass String arrays as parameters to Delegates in C#??
If anybody knows please help me with a sample thread..
Or the moderators may please move this thread to the appropriate forum..
Sorry for posting in the wrong forum..
|
|
|
|
|
Hi all,
I am having a form and in that a tab control is loaded.
On clicking of a button in that form a sub form has to be loaded as dialog box. When the "Ok" button is pressed in the sub form, it has to be closed.
When I tried with the above, the sub form is opening and when the manipulations were completed and the "Ok" button is clicked, it closes the main form.
Can any one faced this problem?
It would be a great help if you can suggest me a way to get rid of this problem.
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
It would be helpful if you can show your code.
|
|
|
|
|
|
Hi there,
I'm writing an application that will do some logging to a flat file, particularly I want to append log entries to an XML file. In order to do this, I seek advice for an appropriate design for this to work.
Say I have a class that defines the types of information I want to store for instance,
// Very briefly
public class LogEntry
{
private string workstationName;
private string message;
public string WorkstationName
{
get { return workstationName; }
set { workstationName = value; }
}
public string Message
{
get { return message; }
set { message = value; }
}
public LogEntry()
{
}
}
If I want to make log entries like these, and append them to an XML file, how would I go about achieving this efficiently. Now I know I can't really use XmlDocument since it's the DOM way, it caches the entire schema in memory. I want to implement in a way that it keeps appending to the XML file without actually caching in memory, and will be closed at the end of the application. If I were told to use XmlWriter or XmlTextWriter, it seems like a chore to write the the start and closing tags for each value I write. Is there an easier way to do this? Also I don't really want to use Logging frameworks like log4net. I think it's overkill for what I want to do. XML flat file is fine but I want to implement it properly.
Please advise, thanks.
|
|
|
|
|
Zerox MXI wrote: If I were told to use XmlWriter or XmlTextWriter, it seems like a chore to write the the start and closing tags for each value I write
You can't avoid this as XML files needs tags. Also I don't think that XML files are not a good idea for logging, I am not sure on this. What is the problem of using simple text files ?
|
|
|
|
|
I just want a more portable format in comparison to a text file. Well, if large scale logging or speed is a requirement then it's obvious flat file logging will lose out. I just wanted simple, but I want the format of the log files be XML so I can use it in any way possible in the near future. Probably things like translating them into other formats like HTML, text using XSLT and stuffs.
I think it's really a nice format for a variety of uses as compared to a text file.
Yes I know what is an XML file and it has tags in them, but I want appending of data to be more transparent. Say AddLogEntry("Something"), and it'll append nicely into the XML file. I would like to do it from the class approach, rather than reading the data from the object and then writing it to the XML by specifying the open and close tags all the time.
|
|
|
|
|
XMLTextWriter class can't append nodes to XML file. You have to use XMLDocument class, add a new node and call it's Save() method. But XMLDocument class loads the whole XML file initially. This can be a performance issue.
I suggest you to write to plain text file. Each log entry will be appended as a new line to the file. When you need to generate reports, create a XML file by reading this text file data. I guess this method will be efficient.
|
|
|
|
|
I suggest you seriously look at fixed width files. Have a look at Log4Net or some such logging framework.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Why reinvent the wheel. Look at the Enterprise Library Logging Application block
only two letters away from being an asset
|
|
|
|
|
All,
I have a requirement for accessing the information that you get when you right-click on an executable and select 'properties'. 'CompanyName', 'Version' etc.
Anyone have any idea how this can be achieved in C#? I have searched but can find nothing.
Thanks,
Darin
|
|
|
|
|
|
we all know that there is an Open source Cross platform like of the Microsoft .NET development platform called MONO.... i have opened this Board for discussing whatever we are thinking about mono. The purpose is to clarify what is possible and what is dream.
I'm not an expert in either Microsoft .Net nor MONO (Unix .Net if i can say). I'm looking to be an expert in one of these since i have Linux and Windows knowledge. but i have limited time for both, so i need to dedicate my time for one at the same time I'm a supporter to the Open Source idea of MONO...
please have a look at http://www.mono-project.com and then add your questions and comments.
B.R
Ahmad Zuhd
modified on Monday, April 28, 2008 4:01 AM
|
|
|
|
|
Please don't use bold for the whole post.
|
|
|
|
|
We talk about C# in this forum. If it happens to work under Mono, that's fine, be we don't talk specifically about it because, well, this is a Windows programming site.
"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've used Mono and am familiar with it, but this is a question/answer forum.
Mono is a follower, not a leader. So if you're going to dedicate your time I would suggest .Net and then incorporate that into what you'd like to learn about Mono later.
|
|
|
|
|
I want to use the event of other class in my main clas help me out.
public class ParenctClass
{
public delegate void myDel(string data); .
public event myDel MYEVENT;
public void Some Fucntion
{
// Thourgh function i put some data in "data"
}
}// end Parenct Class
public class MainClass
{
// here how can i access "MYEVENT" event
}
thaks in advance for reply
|
|
|
|
|
Is MainClass derived from ParentClass ? Your event is raised by your class. You can override the method that does this, and/or subscribe to whatever event gets fired to do this. You can also hook up the derived class to recieve the event.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
No sir the MainClass in not overrided from Parent class.
I got your idea but the probem is that MainClass is i overrideing from "Form" class
No the condition is same i have to call the ParenctCass(parent in sence i have to call my Custom Event) and use my ovent event.
|
|
|
|
|
Declare the event static in your parent class and then subscribe to that event from the main class
public class Parent
{
public delegate void MyDelegate(string str);
public static event MyDelegate MYEvent;
public void Myunc()
{
if (MYEvent != null)
{
MYEvent("hello listeners");
}
}
}
<pre>
public class MainClass
{
public MainClass()
{
//subscribe to the event from Parent Class
Parent.MYEvent += new Parent.MyDelegate(Parent_MYEvent);
}
// called when event is triggered
public void Parent_MYEvent(object sender, EventArgs e)
{
}
}
|
|
|
|
|
good answer but your event handler doesnt match the delegate:
public void Parent_MYEvent(object sender, EventArgs e)<br />
{ <br />
<br />
}
should be
public void Parent_MYEvent(string info)<br />
{ <br />
<br />
}
|
|
|
|