To do this you need an RepositoryItemImageComboBox
RepositoryItemImageComboBox imageCombo = GridControl.RepositoryItems.Add("ImageComboBoxEdit") as RepositoryItemImageComboBox;
imageCombo.SmallImages = imageCollectionTyp;
imageCombo.Items.Add(new ImageComboBoxItem("Zeitraum", MyEnum.Val1, 0));
imageCombo.Items.Add(new ImageComboBoxItem("Gruppe",MyEnum.Val2, 1));
imageCombo.GlyphAlignment = DevExpress.Utils.HorzAlignment.Center;
SellTimeGridView.Columns["Type"].ColumnEdit = imageCombo;
The problem is perfectly described here on stackoverflow.
To resolve this issue just follow this arcticle on msdn
The problem (and of course a simple solution) is perfectly described here (German).
Today I asked myself about restarting a program by code correctly. We all know the Process class and can kill the program directly but that’s not very nice. After a little search I stumbled over the Application.Restart() method. I tested it and it works fine 🙂
I tried all from Environment.NewLine till /r/n, nothing seems to work. Use %0d%0A instead and it works 🙂
Happy coding 😉
First of all, read this post from Jeff Atwood and then this one from Steven Sanderson. Awesome articles.
If your BLL already exists you can use this automation to initially create your test methods.
Rich Newman made a great and simple introduction to the Smart Client Software Factory (SCSF) and Composite Application Block(CAB) .
Today I found one real world example for using extension methods in C#.
Maybe you know this code snippet from your own code:
If(object != null)
MessageBox.Show(„Value:“ + object.ToString().Trim());
I think it looks way to complex, for this stupid task.
Now lets write a extension method which checks for us
=> if the object is null return an empty string
=> if the object is a whitespace string return an empty string too
=> if the object is a normal string, returns it but with a automated trim() to remove annoying white spaces.
How to achieve that:
1. Create a public static class called „StringOptimizer“ and then create the function ToStringIntelligent.
public static class StringOptimizer
public static string ToStringIntelligent(this object _object)
if (_object == null)
See the extension in the parameter _object. You use this before parameter declaration, that’s all.
Now to call this function your just do this:
Console.WriteLine("Value:" + item.ToStringIntelligent());
Note, no validation have to happen here, cause we do it in the extension method already. Extra plus is, that this method actually works with all types that derives from object, so you can use it with your string variables as well. Of course, we could use string.IsNullOrEmpty() function from the .NET framework, but I like to do the validation in just one method, instead of writing validation code for all string objects manually.
Another example is here on codeproject