MessageBox in UDF and HttpWebResponse: strange problem

May 26, 2011 at 12:50 PM

Hi,

I'm feeling a bit silly, but I have the following strange problem with a UDF. Within the UDF, when I do

            MessageBox.Show("Hello");
            HttpWebResponse response = (HttpWebResponse) request.GetResponse();

the message box will show up. However, when I do

            HttpWebResponse response = (HttpWebResponse) request.GetResponse();
            MessageBox.Show("Hello");

the message box will NOT show up.

I am using VS C# 2010 Express to build a library, and pack that up with ExcelDNAPack to a XLL.

Host is Excel 2007 on Win7 64 Bit.

I have double checked the behaviour .. reproducible .. I'm lost;(

Any hints what I could try or what the prob is?

Thanks alot, cheers, Tobias

Coordinator
May 26, 2011 at 1:05 PM

Is there perhaps an exception thrown by the GetResponse() call?

May 26, 2011 at 1:27 PM

oh, mei;)

yep, that was the problem .. solved. I thought, since the response object has a http status code, it wouldnt throw … but it does.

sorry for the blabber …

Cheers,

Tobias

Von: govert [email removed]
Gesendet: Donnerstag, 26. Mai 2011 14:06
An: Tobias Oberstein
Betreff: Re: MessageBox in UDF and HttpWebResponse: strange problem [exceldna:259084]

From: govert

Is there perhaps an exception thrown by the GetResponse() call?