|
In deed I am unused with breakpoints, but I got that nice old error message, asking me if I want to send the error to microsoft..
|
|
|
|
|
Fair enough - but, if you'd said that to start with then we wouldn't have needed this exchange to determine that.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Hi!
First I would use a 'try-catch' just like:
try {
-your code-
} catch (Exception expt) {
System.Windows.Forms.MessageBox.Show(expt.ToString());
} // try-catch
The Next Point is that inline-code is easy to programm but hard to debug, so it's no good style to do everytrhing in a single line. So split your code:
string[] strArrayGot = Got.Split(":".ToCharArray(),2);
TO[num].Receive(strArrayGot[1]);
The next thing you have todo is watch your debugger. Then you can find out where the program exists.
I just talk about your variable names. But its hard to read. What the hell is TO and what about TOS? And listBox1 isn't a good name, too. What is handled there? The Number '1'?
Ok, you can programm that way, but it's hard to read and hard to find errors, so you should try to code a little bit more readable.
Hope I didn't dumbfounded you, was just an idea.
Greetings,
Ingo
-- modified at 4:47 Tuesday 31st January, 2006
|
|
|
|
|
Ok, there's no secret about it. TO is an array of forms, TOS is an array of integers. So when I try to open a new form, first i must know which form to try to open. It's part of a dumb mechanism. My problem is with num. I am SURE I am not trying to open the wrong form, but I want to ask you, could the rest of the function that calls TO[num].Show() be the problem? And by the way, my program is full of try-catch but you see, this error doesn't throw any exception, it displays a part of the form it should display and it stops working. Then I get that nice message about sending the report and I wonder if microsoft's coders want to help me solve the problem... ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Ok sounds good.
So TO[num] is available and not null?! the string you give to receive(...) is ok?
Then I see the problem, if you thought to check this. The programm should work, but it doesn't. I got a similar error a few weeks ago.
The application crushed while calling a method of an object which was definitivly ok. The solution - sound strange - was to build the project new. I started with an empty projectmap, added empty projects, copied the forms and classes in the directory added each class and compiled again. After that the programm runned whithout any mistake (did I mentioned that I hate .Net? ) !
Greetings,
Ingo
|
|
|
|
|
The solution to the problem remains illusive... please if anyone can help me... I wonder if the problem is that I am calling TO[num].Show() from
public void OnReceive(IAsyncResult ar) , now is have to go...
|
|
|
|
|
I don't think so. Why should there be a problem. It's just an event. But you can find out. Don't show the form, start a timer instead, then from the timer-event you can show the form after e.g. 100 ms. If that works, you got the problem, if it doesn't work you know that this isn't the problem.
Greetings,
Ingo
|
|
|
|
|
Ok, I am finally home and I am going to try the timer thing...
|
|
|
|
|
Tried the timer, it simply doesn't trigger. Nothing hasppens. It is incredible. ![Hmmm | :|](https://www.codeproject.com/script/Forums/Images/smiley_line.gif)
|
|
|
|
|
You can't display a form from a threadpool thread (which I think OnReceive is). This[^] article tells you why it's a bad idea to do any UI manipulation from a non UI thread. For your problem, I'd suggest calling Invoke like this
delegate void FormShowDelegate(Form f);
public void OnReceive(IAsyncResult ar)
{
TO[num].Invoke(new FormShowDelegate(ShowForm), new object[]{TO[num]});
}
private void ShowForm(Form f)
{
f.Show();
}
This of course, assumes that you populated the TO[num] array from the UI thread..
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thank you verry much. I found out that the function runs in a new thread (or something like that) and to call a function in the main thread I would use invoke a few hours ago. Still, thank you very much, I'm so happy the program works now
Cheers ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
I'm a bit of a tyro when it comes to .net, so I'm sorry if this question sounds very basic.
I want to create an EXE, which will offer a File Open dialog box. The user has to select a DLL which contains a class that implements a specific interface. I want to be able to create an instance of the class contained in the DLL and call some methods that it exposes, passing certain parameters and receiving return values.
How can I do this? I'd be grateful if anybody can kick me in the right direction.
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
i dont mind to be
a stupid,better than being a moron - Adnan Siddiqi.
|
|
|
|
|
Hi Vikram,
Guess the following link will help you.
http://www.kdkeys.net/forums/785/ShowPost.aspx
Thanks and Regards
Pani
|
|
|
|
|
Thanks, Kodanda Pani.
I don't know VB, but I should be able to decipher it.
Thanks very much.
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
i dont mind to be
a stupid,better than being a moron - Adnan Siddiqi.
|
|
|
|
|
Reflection is the way to go. You can use Assembly.Load[^] or one of its variations to get an Assembly object, then use the GetExportedTypes[^] method on that Assembly object to retrieve types in that assembly. You can then iterate over the types and use FindInterfaces[^] to check if that type implements the interface you want. Activator.CreateInstance[^] creates instances given the type and you should find it simple from there on.
Remember though, the assembly gets loaded in your AppDomain, so it won't get unloaded till your app (or your AppDomain) shuts down. So if some other process tries to write to that assembly, it will fail.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks, Senthil. I'll look into your links.
Would you be interested in writing an article with me, on something that uses this? If you're interested, I'll explain what it's about.
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
Hello,
I want to get html flow when the page is called. I need to save the flow of page when user valid page to save it under txt file. Have you got an idea.
Thanks
|
|
|
|
|
|
In fact I want to save the contents of the page when the user valids it. To do this I try to use WebRequest command but I have an error when I called the page whith specifique control (security error). It's important for me to keep a trace of html contents. If you have another idea to do this tell me about it.
|
|
|
|
|
Hey howzit,
I am very new to the C# .NET environment and am learning every day, but I need to be able to launch the default mail recipient e.g. Outlook from my C# application. Could anyone help me out, please try keep the code simple.
Much appreciated!
|
|
|
|
|
The following snippet launch the systems default email client
<br />
System.Diagnostics.Process.Start("mailto:test@test.com");<br />
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
Hey there,
Thanks for that code. Is there way of specifying which file(s) to include in the new email as attachments?
|
|
|
|
|
I don't know, but you can use third party component like DotNetOpenMail[^]
.Using "mailto:" you can specify subject ,body - but not file .
DevIntelligence.com - My blog for .Net Developers
|
|
|
|
|
Hi howzit?
Does anyone know how to add annotations to an EXISTING PDF programmatically? I have been fiddling with iTextSharp from SourceForge.net but it only allows you to create new blank PDF's and then add annotations.
Any help would be greatly appreciated!
|
|
|
|
|