Click here to Skip to main content
15,883,967 members

Articles by johannesnestler (Tip/Tricks: 9)

Tip/Tricks: 9

RSS Feed

Average article rating:

No articles have been posted.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.67

Desktop Programming
Windows Forms
13 Jan 2012   Updated: 13 Jan 2012   Rating: 3.86/5    Votes: 6   Popularity: 3.00
Licence: CPOL    Views: 16,720     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
Nice solution agent154, I'd just suggest to implement it as extension methods for data row: (and I don't liked your "error reporting" with the '0' Value - because '0' could be a valid index). But I have to say, even if you don't have a database behind the datatable you can use sorting (LINQ,...
Programming Languages
C#
1 Jul 2011   Updated: 1 Jul 2011   Rating: 4.83/5    Votes: 4   Popularity: 2.91
Licence: CPOL    Views: 10,623     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Your tip is useful for main forms with no close or cancel button. But most time you will want the "escape-close-form-behaviour" only with dialogs. This is the recommended way to do it: (Now i see Indivara already mentioned it in the comments)using System;using...
21 Jul 2010   Updated: 23 Jul 2010   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 4,080     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
OriginalGriff has made a nice and small class. But I don't think I would use this code in an application. Most times when I want to know about the inheritance chain of an object is while I'm coding. So a quick and nice (commandline?) tool would be a better fit, I think. The problem with...
24 Sep 2010   Updated: 24 Sep 2010   Rating: 4.67/5    Votes: 2   Popularity: 1.40
Licence: CPOL    Views: 19,301     Bookmarked: 5   Downloaded: 0
Please Sign up or sign in to vote.
Useful function, but I don't see any need for an recursion here. I'd solve it like this:private static Control FindControlParent(Control control, Type type) { Control ctrlParent = control; while((ctrlParent = ctrlParent.Parent) != null) { ...
21 Dec 2010   Updated: 21 Dec 2010   Rating: 4.67/5    Votes: 3   Popularity: 2.23
Licence: CPOL    Views: 11,331     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
I think your solution is good if I have to control quality, compressionetc.For a fast conversion I do just this.Bitmap bmp = new Bitmap(@"C:\Example.bmp");bmp.Save(@"C:\Example.gif", ImageFormat.Gif);
12 Jul 2011   Updated: 12 Jul 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 6,161     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
I think your function is no (theoretical) replacement for the is operator.The is operator takes an object (left) and a type (right) as arguments, not two objects.The is operator considers inheritance. Look at this (executable) example:using System;namespace IsOperatorCheck{ ...
27 Nov 2011   Updated: 27 Nov 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 9,310     Bookmarked: 3   Downloaded: 1
Please Sign up or sign in to vote.
I'd like to offer a "funny" alternative by using a dummy TextBox. public static Bitmap GetPlainTextBitmap(string strText, Font font, Color colorBack, Color colorText, Size sizeTargetBitmap) { // Create a dummy TextBox TextBox txDummy = new TextBox(); ...
15 Feb 2012   Updated: 15 Feb 2012   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 5,250     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
It's not realy an alternate - but I think it should be mentioned. Most time you have this kind of code during initialization. So why not use this:StatusProgressBar spb = new StatusProgressBar() { IsIndeterminate = false, Visibility = Visibility.Visible, ...
C# 4.0
18 Jan 2012   Updated: 18 Jan 2012   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 14,900     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
Very good tip. I just want to mention an alternative - you can just change your project output type to a console application. (You can undo it later if only needed for debugging). So if you started with a Windows Forms project in Visual Studio: Go to project properties/application/ and in the...

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
Austria Austria
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.