A Developer Journey who codes for fun

Daily Dose Of Code

  • Home
  • Dot.Net Basics
    • .Net Basics
      • CTS
      • CLS
      • CLR
      • Strong Vs Weak Ref
      • .Net Framework
      • What is Manifest
    • Memory Management
      • Garbage Collection 1
      • Garbage Collection 2
      • Circular Reference
  • C Sharp
    • Abstract Class in C#
    • Interfaces in C#
    • Value type by Val and By Ref
    • Var keyword
    • Null Coalescing Operator
    • Buit-in code snippets
  • OOPS
    • Abstraction and Encapsulation
    • Polymorphism
    • Inheritence
    • Aggregation
  • Threading
    • Delegates
      • Calling Delegate using Invoke, BeginInvoke
      • Multicast Delegate
      • Exception Handling in Multicast Delegate
      • Action
      • Predicate
      • Func
    • Synchronization
    • Thread Pool
    • Exception Handling
    • TPL
  • Design Pattern
    • Creational Patterns
      • Singleton Pattern
      • Factory Pattern
      • Abstract Factory Pattern
      • Prototype Pattern
      • Builder Pattern
    • Structural Patterns
      • Adapter Pattern
      • Bridge Pattern
      • Composite Pattern
      • Proxy Pattern
      • Facade Pattern
      • Decorator Pattern
      • Flyweight Pattern
    • Behavioral Patterns
      • Command Pattern
      • Interpreter Pattern
      • Iterator Pattern
      • Mediator Pattern
      • Memento Pattern
      • Observer Pattern
      • State Pattern
      • Strategy Pattern
      • Visitor Pattern
      • Chain Of Responsibility Pattern
      • Template Pattern
  • Data Structures
    • Generic List in C#
    • 2d array to 1d array
    • 3d arrayto 1d array
    • Linked List
      • Singly Linked List in C#
    • Queue
      • Dummy Data 1
    • Stack
      • Dummy Data 2
    • Tree
      • Dummy Data 3
    • Graph
      • Dummy Data 4
  • WCF
    • WCF Service using VS 2015
  • Scripts
    • Chrome Extensions
      • Create a Chrome Extension
      • Facebook autologout script
      • Gmail autologout script

SQL Tools(JOIN Operator(Inner join, Left join, Right join))

 Unknown     8:28 AM     No comments   

INNER JOIN Operator :-INNER Join return all rows from the join of left table and right table if there are same data available in both tables if no data will match then it will return nullSELECT * FROM Table_Name_1 INNER JOIN Table_Name_2 WHERE Table_Name_1.Column_Name = Table_Name_2.Column_NameYou can divide your result in group like :- If a table...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

SQL Tools(Alias Operator & In Operator)

 Unknown     7:55 AM     1 comment   

ALIAS Name for Column :-SELECT Column_Name AS Alias_Name FROM Table_NameALIAS Name for table :-SELECT Column_Name From Table_Name AS Alias_NameALIAS Example :-SELECT p.FirstName,p.LastName, po.OrderIDFROM Persons AS p, Product AS poWHERE p.FirstName='Saurabh' AND p.LastName='Singh' AND po.OrderID > 2Without using AS SELECT p.FirstName,p.LastName,...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

SQL - Tools (BETWEEN Operator)

 Unknown     8:56 AM     No comments   

SELECT column_name(s) FROM table_nameWHERE column_name BETWEEN value1 AND value2 SELECT * FROM COILS WHERE COIL_NAME BETWEEN SomeValue1 AND SomeValue2 Between operator is like It will select a row where COIL_NAME has SomeValue1 . Value depends on database to database . Some database will select rows where COIL_NAME has SomeValue1 and where COIL_NAME...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

SQL - Tools(Top Clause AND Like Operator)

 Unknown     2:05 PM     1 comment   

SELECT TOP 1 FROM Table_NameThis will select 1 row from tableSELECT TOP 1* FROM Table_Name (Select all columns of 1st row)SELECT TOP 2* FROM Table_Name (Select first two rows of table)SELECT TOP 50 PERCENT * FROM Table_Name (Select 50 % rows from table)LIKE OPERATORSELECT column_name(s)FROM table_nameWHERE column_name LIKE patternIF...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

SQL - Tools ( INSERT,UPDATE and DELETE Statement)

 Unknown     1:01 PM     No comments   

INSERT INTO table_nameVALUES (value1, value2, value3,...)IF a table Persons contains P_Id,LastName,FirstName,Address,City columns.If you want to insert values then :-INSERT INTO PersonsVALUES (4,'Singh', 'Saurabh', 'Sector-23', 'Gurgaon')IF NOT EXISTS (SELECT * FROM Persons WHERE P_Id = 4)BEGININSERT INTO PersonsVALUES (4,'Singh', 'Saurabh', 'Sector-23',...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

SQL - Tools(ORDER BY)

 Unknown     12:51 PM     No comments   

ORDER BY keyword is used for sorting suppose in a table there is a column named first_name.If you want to show the result in ascending order then :-SELECT * FROM Persons WHERE Age >= 25 GROUP BY first_name ASCIf you want to show the result in descending order then :-SELECT * FROM Persons WHERE Age >= 25 GROUP BY first_name DESCBy default it...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

SQL - Tools (WHERE, AND, OR Clause)

 Unknown     12:21 PM     No comments   

Where clause is use for filtering like :-SELECT * FROM table_name WHERE column_name (operator) value(operator) :- =, >, <,! and more operators.A Friends table contains firstName, secondName, address, phone_no and firstName values are :- saurabh, sandy, gaurav, somu, saurabh and address column values are :- kanpur, allahabad, delhi, kanpur, varanasi.SELECT...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

SQL - Tools....(SELECT Clause)

 Unknown     11:41 AM     No comments   

SELECT :-SELECT * FROM TABLE_NAME this will select whole table If Coils table contains 5 columns p_id, coil_no, coil_width, coil_length, coil_name.Then you have to select coil_width and coil_no like :-SELECT coil_width, coil_length FROM CoilsIf you have to select distinct columns from table like coil_name columns have ABCDE12, ABCD13, ABCD14, ABCD12,...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Visual Studio .Net ShortCut keys

 Unknown     5:19 AM     No comments   

DecreaseFilterLevel : ALT + ,IncreaseFilterLevel : ALT + .GotoBrace : CTRL + ]GotoBraceExtend : CTRL _ SHIFT + ]LineEnd : ENDLineEndExtendColumn : SHIFT + ALT + ENDToggleWordWrap : CTRL + E, CTRL + WScrollLineDown : CTRL + DOWN ARRAYLineDownExtendColumn : SHIFT + ALT + DOWN ARRAYWordDeleteToEnd...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to implement a progressBar while opening a textFile in an application ?

 Unknown     3:16 AM     No comments   

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 /// ///...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What is Reference counting in COM ?

 Unknown     1:56 AM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What is COM ?

 Unknown     12:51 AM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How can we make Windows API calls in .NET?

 Unknown     12:26 AM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

ShFileOperation not working under Wista and Windows7.

 Unknown     1:50 AM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to convert 2d array to 1d array ?

 Unknown     5:01 AM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to convert 3d array to 1d array ?

 Unknown     4:39 AM     1 comment   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What is the difference between .ToString() and Convert.ToString() ?

 Unknown     3:40 AM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Built-in Code Snippets (C#)

 Unknown     11:55 PM     No comments   

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 :-...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

.Net Standard Date-Time-Format strings

 Unknown     11:13 PM     No comments   

Have a look on this image you will find very interesting i mentioned all the date-time format strings in this ima...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Message-Box refreshing issue

 Unknown     10:34 PM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to collapse Environmental variables in a path using C# ?

 Unknown     4:39 AM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to allign multiple strings using seperator in C# ?

 Unknown     4:20 AM     No comments   

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...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to check invalid characters in path using C#

 Unknown     3:26 AM     9 comments   

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){ ...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Delegates in C#

 Unknown     9:58 PM     No comments   

Event - Delegates are the key feature of C#,You can say heart of C#.Look on a example :- Suppose if you have two forms and there is no communication between those even you can't create object to access then how will you send some information.In this tutorial i will teach you how to handle and play with delegates to proper communication.Suppose you...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Generics in C#

 Unknown     5:36 AM     No comments   

Hi everyone..in .net 2.0 we do programming in a very smarter way Generics is the example like if we are using minimum finction to find minimum between two numbers they may be integer,string,object and may be some other data types.Consider the following code :-Returns minimum between two integers.int Min( int a, int b ){if (a < b) return a;else return...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Singleton Pattern

 Unknown     10:08 PM     4 comments   

Singleton pattern is a design pattern that is used to restrict instantiation of a class to one object. This is very useful when only there is a need of single object which handles all the actions across the system.This pattern restrict the instantiation to a certain number of objects and this concept is to generalize the systems to operate more efficiently...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Custom Number Formats.

 Unknown     12:30 AM     No comments   

I found something very interesting regarding number formats.have a look on the im...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What is LINQ?

 Unknown     3:03 AM     No comments   

■ LINQ is a uniform programming model for any kind of data. LINQ enables you to queryand manipulate data with a consistent model that is independent from data sources.■ LINQ is just another tool for embedding SQL queries into code.■ LINQ is yet another data abstraction lay...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Remove special characters from string ?

 Unknown     3:39 AM     No comments   

public override string ToString(){ string specialCharacters = "~!@#$%^&*<()+=`',.?>/\\\""; string[] stringAfterRemovingSpecialCharacters= displayText.Split(specialCharacters .ToCharArray()); return string.Concat(stringAfterRemovingSpecialCharacters...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

File/Folder is being used by another process Error?

 Unknown     2:14 AM     No comments   

Hi Friends..Resolved Error - File/Folder is being used by another process As i discussed in my current project i made a self explorer.exe so i accessed all the folders,files .i am doing same behaviour as lioke window explorer.exe. But I was facing a error This file/folder is being used by another process and all that and i face all these errors when...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

List with ForEach

 Unknown     3:49 AM     No comments   

List Names = new List(); Names.Add("Saurabh"); Names.Add("Somu"); Names.Add("Sandy"); //For every item in the list, say you want to append the last name "Somu" and print it //WITHOUT ForEach() foreach (string name in Names) { Console.WriteLine(name + " Somu"); } //WITH ForEach Names.ForEach(delegate(string name) { Console.WriteLine(...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Yield Keyword

 Unknown     2:03 AM     No comments   

class Program { static void Main(string[] args) { List Names = new List(); Names.Add("saurabh"); Names.Add("somu"); Names.Add("vivek"); foreach (string item in GetNames(Names)) { Console.WriteLine(item); } } public static IEnumerable GetNames(List...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

?? keyword

 Unknown     1:47 AM     No comments   

?? keyword is used to check null.Example using if-else statement:-if (tempString == null){ x = "Null string";} else{ x = tempString ;} Console.WriteLine(x); Example using ?? Keywordstring tempString = null; string x = tempString ?? "Null string"; Console.WriteLine(x); //Prints "Null stri...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Problem about Instances...

 Unknown     7:56 PM     No comments   

Hii..Frends this is very genuine problem.Functionality :-When i was developing Window Explorer control for my application then i just stuck in a problem I had three instances of window - explorer.. One is as similar as Window file explorer by which you can drag drop files and that will open in any editor.(We had given additional functionality like...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to Copy,Delete,Rename and Move files and create new directory using Shell32 in C#?

 Unknown     2:41 AM     No comments   

#region Enum public enum FileOp { Move = 0x0001, Copy = 0x0002, Delete = 0x0003, Rename = 0x0004 } [Flags] public enum FileOpFlags { MultiDestFiles = 0x0001, ConfirmMouse = 0x0002, Silent = 0x0004, RenameCollision = 0x0008, ...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to create FilePropertyDialog like Windows in C#?

 Unknown     7:45 AM     No comments   

#region Enum[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct SHELLEXECUTEINFO { public int cbSize; public uint fMask; public IntPtr hwnd; [MarshalAs(UnmanagedType.LPTStr)] public string lpVerb; [MarshalAs(UnmanagedType.LPTStr)] public...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to stop multiple instances running of my application using C# ?

 Unknown     1:47 AM     No comments   

public static void Main(){ bool isNew = false; Mutex mtx = new Mutex( true, "MyApp_Mutex", out isNew ); if( !isNew ) { MessageBox.Show( "MyApp is already running." ); return; ...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How many instances are running in my application using C# ?

 Unknown     12:24 AM     1 comment   

#region Directivesusing System.text;using System.Threading;using System.Reflection;#endregionpublic class TestApplication { #region Private Fields The default instance private static TestApplication DefValue = new TestApplication (); The system-wide semaphore private Semaphore semaphore; Initial count for the semaphore(Randonm you can...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to Create a Zip file using C#

 Unknown     11:18 PM     No comments   

public bool CreateZip(string ZipFileName){try{Create an empty zip filebyte[] ZipFolder = new byte[]{100,75,50,16,10,5,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};FileStream fs = File.Create(ZipFileName);fs.Write(ZipFolder , 0, ZipFolder.Length);fs.Flush();fs.Close();fs = null;}catch(Exception ignore){}return tru...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to open a zip file using C# ?

 Unknown     1:56 AM     1 comment   

#region Namespaceusing Shell32;#endregionnamespace TestApplicationToZip{class ZipApplication{public static void Main(string[] args){Create the object of shell.Shell sh = new Shell();Create a namespace and folderItem for the existing folder path.Folder ShellFolder = sh.NameSpace("D:\\saurabh.zip");Folder DirectoryFolder = sh.NameSpace("D:\\Unzipped...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Differences between Connected and disconnected architecture ?

 Unknown     1:52 AM     1 comment   

Hii friends,Today one of my frend ask about what approach is better connected or disconnected architecture ..So let me explain more about this problem :-As the nature of HTTP protocol,.Net web applications are always disconnected so your problem is about connected or disconnected data models."connected" data is always faster as compare to "disconnected"...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What do you meant by Containment in C#?

 Unknown     8:04 AM     No comments   

Containment is the replacement of inheritence,no no if inheritance isn’t the right choice,then the answer is containment, also known as aggregation. Rather than saying that an object is an example of another object, an instance of that other object will be contained inside the object. So,instead of having a class look like a string, the class will...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to handle generic errors in WinApp using C# ?

 Unknown     7:39 AM     No comments   

Pass your exception or error through catch block to this method this will catch your error and show the messagebox regarding that error.Method which take error exception as a parameter and handle that error.public static void LogError(Exception ex){string sourceName = "Application Name";int errorCode = "99";string message = "The application encountered...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What is interface and why we implement interfaces ?

 Unknown     7:02 AM     No comments   

Interface defined by using interface keyword .In visualstudio you can directly add class as a interface its not a class it behaves as a template of the class. Interfaces describe a group of related functionalities that can belong to any class or struct.Interfaces are provided in C# as a replacement of multiple inheritance because C# does not support...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to combine two images into one image in C#?

 Unknown     7:26 AM     No comments   

using System.Drawing;public static System.Drawing.Bitmap Combine(string[] files){ Create a list for images and read images List images = new List(); Bitmap finalImage = null; try { int width = 0; int height = 0; foreach (string image in files) { create a Bitmap from the file and add it to the list. Bitmap bitmap = new...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Location of opening of dialog boxes(window form) in C#

 Unknown     10:26 PM     2 comments   

In my application i used some dialog boxes like about of company some customize message boxes and all that in some dialog boxes I used start position as Center parent but i forget to pass the IWin32Window Owner in show dialog as a parameter regarding that when focus is lost from my application then dialog took desktop as a parent and opens in different...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to set image resolution and paint it in C# ?

 Unknown     5:01 AM     No comments   

using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Imaging; public class Form1 : System.Windows.Forms.Form { Constructor. public Form1() { InitializeComponent(); } Initialize all the...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

More Regular Expressions

 Unknown     11:27 PM     No comments   

To validate a URL with a regular expression :-(http://|ftp://)([\w-\.)(\.)([a-zA-Z...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

C# Tutorial (Chapter - 1) Introduction about C# and .Net framework(1 :- .Net Plateform)

 Unknown     3:28 AM     No comments   

I :-.Net Plateform :-The Microsoft® .NET platform provides all of the tools and technologies thatyou need to build distributed Web applications. It exposes a languageindependent,consistent programming model across all tiers of an applicationwhile providing seamless interoperability with, and easy migration from,existing technologies. The .NET platform...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

C# Tutorials

 Unknown     3:19 AM     No comments   

Hello to all, My next thread is about C#,In my next thread i will divide the C# thread into chapters each chapter will contain all the details about C# and .Net framework its a step by step process so go through to all the thread and please post a comment or email me at saurabhjnumca@gmail.com about this thread please give critics about this thread.If...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to create a session manager in .Net ?

 Unknown     7:51 AM     No comments   

To create a SessionManager to save User objects in memory. It would be HashMap of HaspMaps.It can be used as:SessionManager MySessionManager= New SessionManager()Student S1 = New Student ("Saurabh");Student S2 = New Student ("Sandeep");Student S3 = New Student ("Deepak");//To create sessionMySessionManager.createSession(S1);MySessionManager.createSession(S2);//SAVING...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Tech-Giant(Jargons.. for Professionals): How to take Screenshot of panel,control and save it in a JPG format ?

 Unknown     6:58 AM     No comments   

Tech-Giant(Jargons.. for Professionals): How to take Screenshot of panel,control and save it in a JPG format...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to take Screenshot of panel,control and save it in a JPG format ?

 Unknown     6:17 AM     No comments   

You can create a bitmap of screen and then save it give the stream or fileName and then dispose the object of screenshot.Bitmap theScreenShot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);theScreenShot.Save(stream_or_filename, ImageFormat.Jpeg);theScreenShot.Dispose();Another way to...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Order of Event firing in ASP.Net

 Unknown     3:13 AM     1 comment   

Event firing order becomes critically important when you add event handling code to master pages and the content forms based on them. The following events occur when ASP.NET renders a page. I’ve listed these events in the order in which they occur.1 :-Content Page Pre Initializes2 :-Master Page Child Controls Initialize3 :-Content Page Child Controls...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Lambda Expressions in C#

 Unknown     2:49 AM     No comments   

Lambda expressions makes the searching life much easier.Have a look on this example :-public class TestLambdaProgram{ public static void Main( string[] args ) { List names = new List(); names.Add(“Saurabh”); names.Add("Garima"); names.Add(“Vivek”); names.Add(“Sandeep”); string stringResult = names.Find( name =>...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Basics of .Net (What is IL,CLR,CTS,CLS ?)

 Unknown     6:23 AM     3 comments   

1: IL(Intermediate Language) :-(IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler. Microsoft Intermediate...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What are different types of JIT ?

 Unknown     1:42 AM     No comments   

In .net there are three type of JIT.JIT compiler is a part of the runtime execution environment.Three JIT are following :-Pre-JIT :- Pre-JIT compiles complete source code into native code in a single compilation cycle. This is done at the time of deployment of the application.Econo-JIT :- Econo-JIT compiles only those methods that are called at runtime....
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What is Manifest in .net ?

 Unknown     1:24 AM     No comments   

An assembly manifest contains all the metadata.It means Assembly metadata is stored in Manifest and it needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes.Some points are given please go through it :-1:- The assembly...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to view a Assembly of your code (What is ILDASM ?)

 Unknown     1:36 AM     No comments   

When it comes to understanding of internals nothing can beat ILDASM. ILDASM basically converts the whole exe or dll in to IL code. To run ILDASM you have to go to "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin". Note that i had v2.0...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to copy the text from label in window form at run time ?

 Unknown     11:42 PM     No comments   

Designer view:#region DesignerViewCreate a context menu strip :this.copyPathMenuItem = new System.Windows.Forms.ToolStripMenuItem();this.labelContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {this.copyPathMenuItem});this.labelContextMenuStrip.Name = "labelContextMenuStrip";this.labelContextMenuStrip.Size = new System.Drawing.Size(100,...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How can I change the Border color of my control ?

 Unknown     6:40 AM     No comments   

public class MyButton : Button { protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); int borderWidth = 1; Color borderColor = Color.Blue; ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, borderColor, borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, ButtonBorderStyle.Solid,...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to change the color of Tab Control in c#

 Unknown     1:49 AM     No comments   

Steps :-1. Set the TabControl's DrawMode to OwnerDraw.2. Handle the DrawItem event.private void ChangeColorOFTabControl(object sender, DrawItemEventArgs e){Font TabFont;Brush BackBrush = new SolidBrush(Color.Green); //Set background colorBrush ForeBrush = new SolidBrush(Color.Yellow);//Set foreground colorif (e.Index == this.tabControl1.SelectedIndex){TabFont...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to set dropdown width according to longest string in C#

 Unknown     11:24 PM     No comments   

If you are using window control then use this method.private void AdjustWidthComboBox_DropDown(object sender, System.EventArgs e){ ComboBox senderComboBox = (ComboBox)sender; int width = senderComboBox.DropDownWidth; Graphics g = senderComboBox.CreateGraphics(); Font font = senderComboBox.Font; int vertScrollBarWidth = (senderComboBox.Items.Count>senderComboBox.MaxDropDownItems)...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to get the file size like windows file property control ?

 Unknown     7:43 AM     No comments   

//Create an object of FileInfo like :- FileInfo fileObject = new FileInfo(selectedFilename);Int64 fileSize = 0;float sizeOfFile = 0fileSize = fileObject.Length;sizeOfFile = fileObject.Length;private const int FILESIZE_IN_KB = 1024;public const int FILESIZE_IN_MB = 1048576;public const int FILESIZE_IN_GB = 1073741824;public const long FILESIZE_IN_TB...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Sort ListView on column click (like windows folder detail view in xp)

 Unknown     6:22 AM     No comments   

Step :1 Firstly Create the object of listviewcolumn sorter class.private ListViewColumnSorter listviewColumnSorter=new ListViewColumnSorter();Step :2 Set ListViewItemSorter property of listViewlistView.ListViewItemSorter = listviewColumnSorter;Handles...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Get AssociatedFileTypes (.txt = TextDocument)

 Unknown     5:07 AM     No comments   

/// /// Get File Type for given file./// /// Pass the path of file/// This method returns Associated file type like :-.pdf = Adobe Acrobat Document.txt = Text Documentprivate string GetAssociatedFileType(string filePath){ private const string STRING_SPACE = " "; string extension = string.Empty; if (!string.IsNullOrEmpty(filePath))...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

File System Watcher in C#(Get notified after any modification)

 Unknown     7:26 AM     No comments   

Drag FileSystemWatcher control in your form from toolbox and add the events for created,deletion and renaming.Ex:-#region Designer viewthis.fileSystemWatcher.EnableRaisingEvents = true;this.fileSystemWatcher.IncludeSubdirectories = true;this.fileSystemWatcher.SynchronizingObject = this;this.fileSystemWatcher.Created += new System.IO.FileSystemEventHandler(this.fileSystemWatcher_Created);this.fileSystemWatcher.Deleted...
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

About The Author

Unknown
View my complete profile

Total Pageviews

Popular Posts

  • Clr - Common Language Runtime
    .Net framework provides a run time environment - CLR. Common language runtime takes the IL code from the compiler( language specific) and p...
  • Auto logout chrome extension for Gmail
    Hello Friends, In the last article we learned to create a sample chrome extension. Here we are going to create auto logout Gmail script as...
  • Predicate delegate in C#
    Hello Everyone, In the article we will talk about Predicate delegate. Predicate is also a delegate which encapsulate a method that takes...
  • .Net Framework overview
    Hello friends : Here i am writing my first article on .Net framework anyways....So the question is What is .Net Framework ? The .Net fram...
  • Nagarro Placement Papers..
    Ques.1 :- Seat Reservation prog for the theatre. Write a function for seat allocation for the movie tickets. Total no of seats available are...
  • Calling the Delegates using Invoke(), BeginInvoke() and DynamicInvoke() ?
    Hello Guys, So in the last article we talked about What is delegate and how can we create a delegate. In this article we will discuss w...
  • What does it mean by disconnected data access architecture of ADO.Net?
    ADO.Net introduces the concept of disconnected data architecture. In traditional data access components, you make a connection to the databa...
  • C code to Check the string has valid identifier or not in.
    #include #include #include char keyword[][10]={"auto","break","case","char","const","...
  • Delegates in C Sharp
    A Delegate is a type variable that holds the reference to a method. Delegates are similar to Pointer to functions in C and C++ When we...
  • Garbage Collection - Automatic memory management
    While thinking of this question few things are coming in my mind ~ How .Net reclaims objects and memory used by an application ? So the ans...

Blog Archive

  • ►  2016 (4)
    • ►  September (2)
      • ►  Sep 03 (2)
    • ►  August (1)
      • ►  Aug 28 (1)
    • ►  April (1)
      • ►  Apr 24 (1)
  • ►  2015 (12)
    • ►  September (10)
      • ►  Sep 30 (1)
      • ►  Sep 29 (1)
      • ►  Sep 28 (1)
      • ►  Sep 27 (2)
      • ►  Sep 26 (3)
      • ►  Sep 20 (1)
      • ►  Sep 19 (1)
    • ►  August (1)
      • ►  Aug 16 (1)
    • ►  March (1)
      • ►  Mar 31 (1)
  • ►  2013 (10)
    • ►  June (1)
      • ►  Jun 16 (1)
    • ►  April (1)
      • ►  Apr 21 (1)
    • ►  February (8)
      • ►  Feb 18 (3)
      • ►  Feb 17 (2)
      • ►  Feb 16 (2)
      • ►  Feb 15 (1)
  • ►  2012 (1)
    • ►  May (1)
      • ►  May 27 (1)
  • ►  2010 (22)
    • ►  October (14)
      • ►  Oct 21 (1)
      • ►  Oct 06 (12)
      • ►  Oct 04 (1)
    • ►  April (2)
      • ►  Apr 22 (1)
      • ►  Apr 16 (1)
    • ►  March (1)
      • ►  Mar 30 (1)
    • ►  January (5)
      • ►  Jan 08 (3)
      • ►  Jan 01 (2)
  • ▼  2009 (110)
    • ▼  December (8)
      • ▼  Dec 18 (2)
        • SQL Tools(JOIN Operator(Inner join, Left join, Rig...
        • SQL Tools(Alias Operator & In Operator)
      • ►  Dec 05 (1)
        • SQL - Tools (BETWEEN Operator)
      • ►  Dec 04 (5)
        • SQL - Tools(Top Clause AND Like Operator)
        • SQL - Tools ( INSERT,UPDATE and DELETE Statement)
        • SQL - Tools(ORDER BY)
        • SQL - Tools (WHERE, AND, OR Clause)
        • SQL - Tools....(SELECT Clause)
    • ►  November (1)
      • ►  Nov 27 (1)
        • Visual Studio .Net ShortCut keys
    • ►  October (14)
      • ►  Oct 09 (4)
        • How to implement a progressBar while opening a tex...
        • What is Reference counting in COM ?
        • What is COM ?
        • How can we make Windows API calls in .NET?
      • ►  Oct 07 (1)
        • ShFileOperation not working under Wista and Windows7.
      • ►  Oct 06 (3)
        • How to convert 2d array to 1d array ?
        • How to convert 3d array to 1d array ?
        • What is the difference between .ToString() and Con...
      • ►  Oct 05 (3)
        • Built-in Code Snippets (C#)
        • .Net Standard Date-Time-Format strings
        • Message-Box refreshing issue
      • ►  Oct 01 (3)
        • How to collapse Environmental variables in a path ...
        • How to allign multiple strings using seperator in ...
        • How to check invalid characters in path using C#
    • ►  September (17)
      • ►  Sep 30 (1)
        • Delegates in C#
      • ►  Sep 29 (1)
        • Generics in C#
      • ►  Sep 28 (1)
        • Singleton Pattern
      • ►  Sep 25 (1)
        • Custom Number Formats.
      • ►  Sep 24 (1)
        • What is LINQ?
      • ►  Sep 17 (2)
        • Remove special characters from string ?
        • File/Folder is being used by another process Error?
      • ►  Sep 15 (3)
        • List with ForEach
        • Yield Keyword
        • ?? keyword
      • ►  Sep 11 (2)
        • Problem about Instances...
        • How to Copy,Delete,Rename and Move files and creat...
      • ►  Sep 09 (3)
        • How to create FilePropertyDialog like Windows in C#?
        • How to stop multiple instances running of my appli...
        • How many instances are running in my application u...
      • ►  Sep 08 (2)
        • How to Create a Zip file using C#
        • How to open a zip file using C# ?
    • ►  August (31)
      • ►  Aug 31 (1)
        • Differences between Connected and disconnected arc...
      • ►  Aug 27 (3)
        • What do you meant by Containment in C#?
        • How to handle generic errors in WinApp using C# ?
        • What is interface and why we implement interfaces ?
      • ►  Aug 26 (1)
        • How to combine two images into one image in C#?
      • ►  Aug 25 (2)
        • Location of opening of dialog boxes(window form) i...
        • How to set image resolution and paint it in C# ?
      • ►  Aug 24 (1)
        • More Regular Expressions
      • ►  Aug 22 (2)
        • C# Tutorial (Chapter - 1) Introduction about C# an...
        • C# Tutorials
      • ►  Aug 21 (3)
        • How to create a session manager in .Net ?
        • Tech-Giant(Jargons.. for Professionals): How to ta...
        • How to take Screenshot of panel,control and save i...
      • ►  Aug 20 (2)
        • Order of Event firing in ASP.Net
        • Lambda Expressions in C#
      • ►  Aug 19 (3)
        • Basics of .Net (What is IL,CLR,CTS,CLS ?)
        • What are different types of JIT ?
        • What is Manifest in .net ?
      • ►  Aug 18 (1)
        • How to view a Assembly of your code (What is ILDAS...
      • ►  Aug 16 (1)
        • How to copy the text from label in window form at ...
      • ►  Aug 12 (2)
        • How can I change the Border color of my control ?
        • How to change the color of Tab Control in c#
      • ►  Aug 11 (1)
        • How to set dropdown width according to longest str...
      • ►  Aug 10 (3)
        • How to get the file size like windows file propert...
        • Sort ListView on column click (like windows folder...
        • Get AssociatedFileTypes (.txt = TextDocument)
      • ►  Aug 07 (4)
        • File System Watcher in C#(Get notified after any m...
      • ►  Aug 06 (1)
    • ►  July (24)
      • ►  Jul 25 (4)
      • ►  Jul 24 (20)
    • ►  April (15)
      • ►  Apr 10 (3)
      • ►  Apr 07 (9)
      • ►  Apr 06 (3)

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments
copyright @ TechGiant 2015. Powered by Blogger.

Disclaimer

This is my personal blog and i write articles on .Net, WPF, C#, OOPS, Threading and other .Net technologies. This is not related to any of my employer and organizations. This is the result of my personal interest.

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Followers

Copyright © 2025 A Developer Journey who codes for fun | Powered by Blogger
Design by Hardeep Asrani | Blogger Theme by NewBloggerThemes.com