Click here to Skip to main content
15,910,877 members
Home / Discussions / C#
   

C#

 
QuestionCross-thread operation not valid on toolstripstatuslabel Pin
Hampus@foi9-Oct-07 0:58
Hampus@foi9-Oct-07 0:58 
AnswerRe: Cross-thread operation not valid on toolstripstatuslabel Pin
Muammar©9-Oct-07 1:05
Muammar©9-Oct-07 1:05 
Questioncustom desktop in C# Pin
amruta kadam9-Oct-07 0:09
amruta kadam9-Oct-07 0:09 
AnswerRe: custom desktop in C# Pin
Muammar©9-Oct-07 0:47
Muammar©9-Oct-07 0:47 
AnswerRe: custom desktop in C# Pin
Mustafa Ismail Mustafa9-Oct-07 0:49
Mustafa Ismail Mustafa9-Oct-07 0:49 
QuestionHow to disable the Automatic ToolTip Of TreeView Pin
Venki568-Oct-07 23:51
Venki568-Oct-07 23:51 
AnswerRe: How to disable the Automatic ToolTip Of TreeView Pin
Luc Pattyn9-Oct-07 0:30
sitebuilderLuc Pattyn9-Oct-07 0:30 
QuestionClass libary streamwriter Pin
Scalee8-Oct-07 23:43
Scalee8-Oct-07 23:43 
I got this very simple code, now it only works once then it crashes.
If i havent overlooked anything its becuase evertime the OnIncomingMessage event is called it creates a new filestream and streamwriter but i have no idea how to fix this.

It has to create a file, write the message, close the file making it accessable to other programs.
And then when the event is fired again it should do it all over.


using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Messenger;
using System.IO;


namespace msnincoming
{
public class msnincoming : IMessengerAddIn
{
private MessengerClient _client;
private string _message;
private FileStream _test;
private StreamWriter _test2;

#region IMessengerAddIn Members

public void Initialize(MessengerClient messenger)
{
_client = messenger;
_client.AddInProperties.FriendlyName = "Incoming message alert";
_client.AddInProperties.Creator = "Scale";
_client.AddInProperties.Description = "Alerts Announcer! of new messages";
_client.IncomingTextMessage += new EventHandler<incomingtextmessageeventargs>(this.OnIncomingMessage);


}

#endregion

public void OnIncomingMessage(object sender, IncomingTextMessageEventArgs e)
{
_message = e.UserFrom.FriendlyName + " says " + e.TextMessage;
_test = new FileStream(@"c:\MSNinc.txt", FileMode.CreateNew);
_test2 = new StreamWriter(_test);
_test2.WriteLine(_message);
_test2.Close();
_test.Close();

}
}
}

Thanks!
AnswerRe: Class libary streamwriter Pin
Luc Pattyn9-Oct-07 0:33
sitebuilderLuc Pattyn9-Oct-07 0:33 
GeneralRe: Class libary streamwriter Pin
Scalee9-Oct-07 0:48
Scalee9-Oct-07 0:48 
QuestionQuestion about switch statement Pin
Andrei Ungureanu8-Oct-07 23:27
Andrei Ungureanu8-Oct-07 23:27 
AnswerRe: Question about switch statement Pin
J4amieC8-Oct-07 23:41
J4amieC8-Oct-07 23:41 
GeneralRe: Question about switch statement Pin
Andrei Ungureanu8-Oct-07 23:43
Andrei Ungureanu8-Oct-07 23:43 
AnswerRe: Question about switch statement Pin
JSSUML9-Oct-07 2:32
JSSUML9-Oct-07 2:32 
Questionwhat is : Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) Pin
B.A8-Oct-07 23:09
B.A8-Oct-07 23:09 
AnswerRe: what is : Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) Pin
Rocky#8-Oct-07 23:18
Rocky#8-Oct-07 23:18 
GeneralRe: what is : Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) Pin
B.A8-Oct-07 23:29
B.A8-Oct-07 23:29 
GeneralRe: what is : Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) Pin
Rocky#8-Oct-07 23:39
Rocky#8-Oct-07 23:39 
Questiondatabinding to control.tag causes changes to dataset Pin
Glen Harvy8-Oct-07 22:59
Glen Harvy8-Oct-07 22:59 
AnswerRe: databinding to control.tag causes changes to dataset Pin
Urs Enzler9-Oct-07 0:47
Urs Enzler9-Oct-07 0:47 
GeneralRe: databinding to control.tag causes changes to dataset Pin
Glen Harvy9-Oct-07 1:32
Glen Harvy9-Oct-07 1:32 
Questiontimer Pin
Tauseef A8-Oct-07 22:46
Tauseef A8-Oct-07 22:46 
AnswerRe: timer Pin
Jon Hulatt8-Oct-07 22:49
Jon Hulatt8-Oct-07 22:49 
QuestionRe: timer Pin
Tauseef A8-Oct-07 22:51
Tauseef A8-Oct-07 22:51 
AnswerRe: timer Pin
Jon Hulatt8-Oct-07 23:51
Jon Hulatt8-Oct-07 23:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.