Click here to Skip to main content
15,178,605 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
Posted: 13 Jan 2012   Updated: 13 Jan 2012   Views: 16,000   Rating: 3.86/5    Votes: 6   Popularity: 3.00
Licence: The Code Project Open License (CPOL)      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#
Posted: 1 Jul 2011   Updated: 1 Jul 2011   Views: 10,011   Rating: 4.83/5    Votes: 4   Popularity: 2.91
Licence: The Code Project Open License (CPOL)      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...
Posted: 21 Jul 2010   Updated: 23 Jul 2010   Views: 3,700   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      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...
Posted: 24 Sep 2010   Updated: 24 Sep 2010   Views: 18,601   Rating: 4.67/5    Votes: 2   Popularity: 1.40
Licence: The Code Project Open License (CPOL)      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) { ...
Posted: 21 Dec 2010   Updated: 21 Dec 2010   Views: 10,421   Rating: 4.67/5    Votes: 3   Popularity: 2.23
Licence: The Code Project Open License (CPOL)      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);
Posted: 12 Jul 2011   Updated: 12 Jul 2011   Views: 5,400   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      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{ ...
Posted: 27 Nov 2011   Updated: 27 Nov 2011   Views: 8,730   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      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(); ...
Posted: 15 Feb 2012   Updated: 15 Feb 2012   Views: 4,860   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      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
Posted: 18 Jan 2012   Updated: 18 Jan 2012   Views: 12,890   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      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.

johannesnestler
Austria Austria
No Biography provided