July 2009 Entries

Adding your WPF control to the toolbox

We all reuse our windows controls out of the toolbox so why not our WPF user controls? The process is really the same. To show the steps involved let’s first write a simple WPF user control. After renaming the control and adding a WPF application project to my solution(to test with), my solution looks like this Since the functionality of the control is not important in this article, I just pasted in some animation code from msdn into my MyDemoControl.xaml file. <UserControl x:Class="MyDemoControl.MyDe...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Santa checked his list, do you?

Have you ever tried to implicitly cast a larger data type into a smaller type (as far as the number of bits) through a plain old assignment? c# wont let you do it! In this case the long’s value of 5 will definitely fit into an int but the compiler will still give you a no-no. Its avoiding possibly dropping some of the 64 bits when assigning the value to 32 bits. Not to worry, you can always do the explicit cast. int myInt; long myLong = 5; myInt = (int)myLong; This lets the compiler know that you...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Being Sensitive in an Insensitive World

SQL Server allows you to set a case sensitive collation at both the database and column level but often you will need to do a case sensitive search when everything is case insensitive. Not to worry, you can set the collation directly in the query. /* To test string equality including case when the DB is not case sensitive you must include collation as part of the test as follows: */ declare @mystring1 varchar(10) declare @mystring2 varchar(10) set @mystring1 ='abc' set @mystring2 ='ABC' -- by default...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

«July»
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678