| Martin's profileMake It SoPhotosBlogLists | Help |
|
Make It SoMarch 07 RequiredFieldValidator and CheckBoxRecently I wanted to assure that a CheckBox is checked in an ASP.NET 2.0 form before submitting it. Unfortunately the RequiredFieldValidator doesn't accept CheckBox as a ControlToValidate target.
Wouldn't it be intuitive for these Controls to work together? February 15 Awarded by MicrosoftYesterday I received an ACE (Award for Customer Excellence) from Microsoft. What a nice surprise!
Reason for this is my "extraordinary contribution to the Visual Studio 2005 product". I've been using Visual Studio 2005 since Beta 1 and reported a couple of bugs or helped people on forums solve problems, but I didn't think it would be worth an award.
And what's even nicer is that Visual Studio 2005 turned out to be a great product! I use it for all my new projects (at least those that run on Windows) and also converted some existing VS 2003 projects to the new version.
Anyway, thanks to Microsoft for the award and VS 2005. January 28 First entry from my new Qtek 9100I`m writing this on my new Qtek 9100 Windows Mobile 5.0 Phone. So far I`m very satisfied with it. Everything works as expected, which is not always the case with gadges packet with features such as this phone. December 01 Where's System.Net.Mail.MailAddress.TryParse?.NET 2.0 introduced TryParse functions on certain types which allow to check whether an object value can be converted to a certain target type without resorting to catching FormatExceptions, e.g.
string anyNumberString = "1234";
int anyNumber;
if ( Int32.TryParse( anyNumberString, out anyNumber ) )
{
...
}
Recently I needed a way to check whether a certain string is a valid email address. I knew that this could be accomplished using a more (for any RFC-conformant) or less (for "mainstream" addresses) complicated RegEx. But since .NET 2.0 also introduced a new class MailAddress, hopes were high that it provides a TryParse method which could do this check, e.g.
string anyEmailAddress = test@test.com;
if ( System.Net.Mail.MailAddress.TryParse( anyEmailAddress ) )
{
...
}
Unfortunately, there isn't. At least the MailAddress constructor throws a FormatException if the passed mail address is invalid. November 21 I just wasted half an hour of my life...What's wrong with this code:
Bitmap CreateBitmap()
{
byte[] byteArray;
// fill byte array with bitmap data
using ( MemoryStream ms = new MemoryStream( byteArray ) )
{
return Bitmap.FromStream( ms );
}
}
void UseBitmap()
{
Bitmap bmp = CreateBitmap();
bmp.Save( "test.jpg", ImageFormat.Jpg );
}
It turns out that the code above crashes with the beloved "Internal GDI+ error" exception when Save is called. Inspecting the Bitmap with the Debugger just before Save doesn't show any problems, the members of the Bitmap all look meaningful.
It took me half an hour to find out that the using-Statement in CreateBitmap is the source of the problem. I guess the reason is that the Bitmap doesn't read and cache all the data from the stream, and since the stream is closed at the end of the using-Statement, Bitmap is no longer able to read from it.
So here's what worked for me:
MemoryStream ms = new MemoryStream( byteArray );
return Bitmap.FromStream( ms ); |
|
|||
|
|