Handy little nugget to check if a string exists within another string. Particularly useful if you’re working with a delimited string as I was, as it makes dealing with the delimiters irrelevant.
SELECT * FROM table
WHERE CHARINDEX('string1', 'string2') != 0
In this instance ‘string1’ is the string you’re searching for in ‘string2’. Obviously these could be substituted for columns in a table or whatever.
Crystal Reports seem to be a bit like Marmite, people either love it or hate it! I’m actually quite indifferent, sure there are a number of bug-bears and ‘quirks’ to put up with, but at the end of the day it’s free and it’s what I’m stuck using, so I have little option but to get on with it and make do the best I can.
One particularly irksome feature is the lack of an option to conditionally suppress a Line or Box object, especially when you have a report with multiple total fields that are all underlined with a Line object as I do! It may be possible to draw a line object using a formula, I’m not sure, but an easier alternative is to display your total in a Textbox object, set only the bottom border and then suppress the Textbox using a formula as per usual.
Array enumValues = Enum.GetValues(typeof(your enum type here));
ArrayList enumList = new ArrayList();
foreach (Enum value in enumValues)
enumList.Add(new KeyValuePair<Enum, string>(value, value.ToString()));
ComboBox.DataSource = enumList;
“DisplayMember” and “ValueMember” properties can then be set on the combobox to point to the Key and Value properties of the enumlist.
As anybody who has developed mobile applications with the compact framework (with VS2008 anyway) will know, the build and deployment time on even the smallest projects can be painfully long regardless of whether deploying to the device or the emulator.
Finding this has been a complete life saver (I was almost at the point of self harm waiting for builds!), and has slashed my build times by nearly a minute.
Make sure you take the time to read the full article so you know exactly what the implications are of disabling the ‘PlatformVerificationTask’ validation.
This one had me stumped for a while! If you have multiple list controls (combo’s etc) on the same form set to the same datasource, the default behaviour is for the controls to share the form’s BindingContext ,thus synchronising the current position. This means when you change list position in say ‘Combo A’, the selected index is also changed in ‘Combo B’.
To avoid this behaviour requires just one line of code applied to at least one of your controls.
comboBox1.BindingContext = new BindingContext();
cbo.DataSource = System.Enum.GetValues(typeof(myEnum));