Make a claas like this one to create ProgressBar :-public class StatusProgressBar : ToolStripProgressBar { #region Private Fields private static StatusProgressBar _instance = null; #endregion #region Constructor private StatusProgressBar() { this.Style = ProgressBarStyle.Blocks; this.Step = 1; } #endregion #region Properties /// ///...
What is Reference counting in COM ?
Reference counting is a memory management technique used to count how many times an object has a pointer referring to it. The first time it is created, the reference count is set to one. When the last reference to the object is nulled, the reference count is set to zero and the object is deleted.Care must be exercised to prevent a context switch from...
What is COM ?
Microsoft’s COM is a technology for component software development. It is a binary standard which is language independent. DCOM is a distributed extension of COM.Microsoft COM (Component Object Model) technology in the Microsoft Windows-family of Operating Systems enables software components to communicate. COM is used by developers to create re-usable...
How can we make Windows API calls in .NET?
Windows API call are not COM based and they are invoked through Platform Invoke Services.StringConversionType is for what type of conversion should take place. Either we can specify Unicode to convert all strings to Unicode values, or Auto to convert strings according to the .NET runtime rules.There are few thumbrules to make API calls :-1:- MethodName...
ShFileOperation not working under Wista and Windows7.
I've used ShFileOperation for file operations but was facing some problems and i was not able to understand then i do googling and found the 'cause' of the problems with the SHFileOperation function in Vista . It turns out that this function is not thread safe under Vista. It works fine with earlier operating systems when used in a multi threading...
How to convert 2d array to 1d array ?
Suppose you to insert or get the values from 1d array using 2d dimensions like :-Insert value at (1,2) and the value is 5 then you have to find the logic to get the index :- Firstly you have to know the size of 2d array here suppose :- (2x3)int xPosition = 1;int yPosition = 2;3 is ySize of 2d array.int 1dIndex = (3*xPosition)+ yPosition ;Insert at...
How to convert 3d array to 1d array ?
Suppose you have to insert a value at (2,1,0) and the value is :-5means firstly you have to find the index through (2,1,0) then you have to insert value 5 at that index .Logic is :-Firstly you must have to know the 3d array size suppose here is (3x2x3).int xPosition = 2;int yPosition = 1;int zPosition = 0;int indexOf1dArray = (xPosition *2*3) + ((yPosition...
What is the difference between .ToString() and Convert.ToString() ?
int value = 3;string stringConversion = value.ToString();string stringConversion = Convert.ToString(value);We can convert the integer “value ” using “value .ToString()” or “Convert.ToString” The basic difference between them is “Convert” function handles NULLS .It handles null exception while “value .ToString()”does not it will throw a NULL reference...
Built-in Code Snippets (C#)
List of built in code snippets -
#if :- Creates a #if directive and a #endif directive.
#region :- Creates a #region directive and a #endregion directive.
~ :- Creates a destructor for the containing class.
checked :- Creates a checked block.
ctor :- Creates a constructor for the containing class.
cw :- Creates a call to Console.WriteLine.
for :-...
Message-Box refreshing issue
I have used many message boxes in my current application but in some places where i used list box,list there when i move messagebox then the back screen is looks like everything is removing or cleaning nothing just refreshing issue, then i look and sort out by sinety testing like i used listView.BeginUpdate(); before dialog box check when i used after...
How to collapse Environmental variables in a path using C# ?
Pass the path if there are environmental variables exist in the path then it will be collapsed into a valid path and return the valid path.Constants :-public const string PATH_SEPARATOR = @"\";public const string ENVIROMENT_VARIABLE_FORMAT = "%{0}%";public static string CollapseEnviromentVariables(string pathString) { string result...
How to allign multiple strings using seperator in C# ?
Constant file.public const char SYMBOL_SPACE_CHARACTER = ' ';public static List AlignText(string[] strings, char seperator) { List formattedStringList = new List(); List ListOfCommaSeperatedStringsInLine = new List(); string[] commaSeperatedStringsArray = null; List maxColumnWidthArray = new List(); //split strings into list of comma seperated...
How to check invalid characters in path using C#
If you create a new folder then there are some characters which are not allowed and any thing in which user have rights to create path then firstly check the invalid characters otherwise your application or program will through an exception.Pass the path or string for which you have to check.public static bool CheckInvalidCharacters(string path){ ...