# Thursday, July 08, 2004

Here's a strange thing that happened yesterday. An ASP.NET app, written in VB.NET, was only intermittently dealing with its events, such as button clicks. At first it seemed to be that the event was handled if we were debugging, and not handled if we were not. But that turned out not to be the case.

Whenever you're faced with weirdness -- and let's face it, an event that sometimes is handled and sometimes is skipped counts as weirdness -- the knowledge base is your friend. A team member found 314965, which is a C# version of the problem. Although no-one could find a VB KB article, these are our symptoms, and more importantly this fix was a fix.

SYMPTOMS

A control event on a Microsoft Visual C# .NET Web application form may not fire. The event does not fire if you wire the control event imperatively, that is, if you double-click the event from the Events view and then add the code.

RESOLUTION

Add the event to the HTML code behind the form, that is, wire the control event declaratively.
 
“Wire the control event declaratively” means put an onxxx= attribute in the HTML:
 
<asp:Button id="Button1" runat="server" oninit="Button1_Init" Text="Button1"></asp:Button>
Instead of oninit you might have onclick or whatever event you have an issue with. Also, make your handler function public rather than private.
 
Moral of the story: there are two. First, it isn't always you. I can't tell you how many emails I've received telling me “there must be a bug in Microsoft's C++ optimizer, because my debug builds work beautifully but my release builds blow up.” Experienced C++ programmers mutter or shout “memory problem” when we get such emails: you're overwriting something or leaking or just generally not handling memory well; debug and release builds have huge differences in allocation, initialization, and other memory work when you're using unmanaged C++. Most of the time, it's you. But every once in a while, it's not you. And a quick search through the knowledge base is one way to see if it's you or not. Second, just because you're writing in VB doesn't mean that C# KB articles don't apply to you. Never be a language snob.
 
Kate
 
ps: of course I program in VB sometimes. What else would I use to create ASP.NET apps?
Thursday, July 08, 2004 9:48:33 AM (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, July 06, 2004

I know these things are silly, but anyway:

You are Windows 2000 SP3.  You're a steady and reliable friend.  People think you're all business, but with your recent therapy you've become a little more playful.
Which OS are You?

How did it determine I was service pack 3? I don't want to know. You can see all the possibilities at http://bbspot.com/News/2003/01/os_quiz_all.html. I think I would have rather been XP.

Kate

Tuesday, July 06, 2004 4:21:37 PM (Eastern Daylight Time, UTC-04:00)  #    
# Monday, July 05, 2004

My Microsoft DE, Adam Gallant, is blogging about DevCan so I guess I can too. I'm co chairing two tracks.

What is it? Well it has tracks, so it must be a conference, right? And it has Can in the name, and a maple leaf in the logo, so it's in Canada. And we're planning it now, so it's not in July but nor is it in the spring of 2006.

Stay tuned...

Kate

Monday, July 05, 2004 11:00:59 AM (Eastern Daylight Time, UTC-04:00)  #    
# Thursday, July 01, 2004

”For pure .NET, C++ typically 25% faster than C#” is the only English sentence (other than photos of slides) in a blog entry I just came across. The rest is Italian, but you know that one sentence certainly caught my eye.

The entry describes a June 30th (that would be yesterday!) Herb Sutter talk. I ran it through Babelfish, but automatic translation doesn't do well with technical terms:

Ago from landlady the "Deterministic finalization" where java and C # is under accusation in order not to have conserved the concept of annihilator in the language. The C#/CLI annihilator is the equivalent of the pattern arranged suit.

Er, OK. Still I think the slides say a lot, and 25% faster? 50% faster if there's heavy pinvoke? Wowza! The future of C++ is indeed a much rose-colored one.

Kate

Thursday, July 01, 2004 5:08:17 PM (Eastern Daylight Time, UTC-04:00)  #    

Like this quote?

I may have to retreat from my stance of preferring C# and disliking MC++. With Whidbey, MC++ is a whole new language and nearly all of my current objections to it have disappeared.

It's from the last paragraph of an article by Brent Rector  :-) The article itself is worth a read, too.

Kate

 

Thursday, July 01, 2004 4:55:20 PM (Eastern Daylight Time, UTC-04:00)  #    
# Wednesday, June 30, 2004

In conjunction with the announcement of the Express products, Microsoft's Channel9 is running a coding contest. Each language has its own judge, and yes of course there's a C++ judge. “The Summer of Express contest is a worldwide skill contest where developers are challenged to create “non-business” applications using the newly announced Express products.” And yes, you can use the betas -- in fact that's the whole point.

 Why not?

Kate

Wednesday, June 30, 2004 9:56:54 AM (Eastern Daylight Time, UTC-04:00)  #    
# Tuesday, June 29, 2004

This is fun! If you want to get started using Visual C++ to write managed or unmanaged code, but you don't want to buy the full product, what can you do? You could use the free Visual C++ Toolkit, which I've told you about before, but that doesn't include the IDE though it does include some very nice samples and whitepapers: one blogger was nice enough to say “the samples alone are worth the download.” At Tech Ed Europe, Microsoft has announced the Express versions of the 2005 products, including Visual C++ 2005 Express (that means they're in beta now, whereas the toolkit is the current released version. You can't release products you create with a beta.) You can download now, so go ahead!

Kate

ps: if you know who the gentleman is at the top left of that Visual C++ 2005 Express Beta page, please drop me a note. I swear we've met and it's going to bug me until I get a name.

Tuesday, June 29, 2004 1:40:10 PM (Eastern Daylight Time, UTC-04:00)  #    
# Friday, June 25, 2004

Did you know that one person -- Bob Bemer -- pushed the development and adoption of ASCII? Or that he was also responsible for the backslash and escape keys? (There's more, too, like naming COBOL -- check his site.) Isn't it a shame we don't hear this stuff until the obituary? I love this quote: "He was a coder until he couldn't code any more. He lived it and breathed it." While I love dealing with customers, and doing “big picture” architecting, as well as training and mentoring, I too love to code, and I hope someone can say that about me someday -- 50 years from now would be fine.

Kate

Friday, June 25, 2004 12:39:22 PM (Eastern Daylight Time, UTC-04:00)  #    
# Monday, June 14, 2004

My latest codeguru column, C++ Language Changes for Visual Studio 2005, has been uploaded to the CodeGuru site.

Monday, June 14, 2004 7:53:47 PM (Eastern Daylight Time, UTC-04:00)  #