h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

ArrayList in C#.net


             First time, User uses this ArrayList class this error will occur.
Reason: Because user doesn’t declare a namespace for ArrayList.
Solution: Declare Namespace Using System.Collection.
In this Sample Project, I am using enumeration and ArrayList.



In this Example, I am creating an enumeration and Call that enumeration into ArrayList and sort that ArrayList.
Some useful Methods in ArrayList:
  1. Add
  2. AddRange
  3. Remove
  4. RemoveAt
  5. Sort
  6. RemoveRange
Add:
   User can add a information into ArrayList Using Add Method.
This is a Simple Example for Add Method.



AddRange:
     Add the elements of an ICollection to the end of the ArrayList.
ICollection:
· It is an Interface. Because it starts with “I”. Generally, “I” is called Interface.
· Defines size, enumerators, and synchronization methods for all nongeneric collections.



 
Here, I give a sample code for AddRange Method for ArrayList create a two enumeration .One is ComName and another one is ComPort.
Remove:
       User can remove a list of items in ArrayList.
       User can specify a Word.

 
RemoveAt:
       User can remove a list of items in ArrayList.
       User can specify a Index no.



RemoveRange:
       User can remove a list of items in ArrayList.
       User can specify range of remove.



Process Vs Thread in C#.net

Process:
  1.   It Exists in the OS.
  2.   Each and Every Process Contains One or More Threads.
Thread:
  1.   It exists with in Process
  2. It is a Light-Weight-Process.
  3. Threads Share memories with other Thread running in the Same Application.

Basic XML


Introduction:
· XML -- eXtendable Markup Language.
· It is a Case Sensitive.
· It is a Tag Code.
· Easily, it understands by Machine and Human.
· Storing and Retrieving data.
· All elements can have text content and attributes
XML Code likes this
<FirstName></FirstName>
   Structure of XML:


Root Element:
              It is a Parent Element of all Elements.
ATTRIBUTES:
             Additional information about an element.
ELEMENTS:
              It can be extended and carry more information.
              It can have attributes.
TEXT:
              Value of Every Element. User can Read, Write and Modify.
Create XML file in C#.Net:
Declare a namespace for XML
using System.Xml;
using System.IO;





User can create XML file using XMLWriter.




XML File created in the D Driver.


Read XML File Data:

  User can read XML file in two ways.
1)     Using XMLReader
2)     Using SelectSingleNode
1)     Using XMLReader:
              User wants to read all elements in the XML File using XMLReader.
Now, we go to Coding Section.
Using XMLTextReader:


Window Services in C#.Net


Introduction:
         Recently, I was hunting about Windows Service. So I wrote this article. I just explained windows Service and usage in the .Net Application.
Windows Service:
Windows Service applications are long-running applications that are ideal for use in server environments. Services can be automatically started when the computer is booted. Windows Services are controlled through the Service Control Manager where they can be stopped, paused, and started as needed.
Create Windows Service:
Add Assemblies for Windows Service:
1)  System.Configuration.Install
2)  System.ServiceProcess.
System.Configuration.Install:
Provides classes that allow you to write custom installers for your own components.
System.ServiceProcess:
Allow you to implement, install, and control Windows service applications.
System.ServiceProcess.ServiceBase:
Provides a base class for a service that will exist as part of a service application. ServiceBase must be derived from when creating a new service class.
Every Service should override OnStart() and OnStop() and also Pause, Shutdown and Continue.
Step by Step Processing:
· Create New Application.
· Select Windows Service in the Template Window.
· Go to Program.cs file.
· Declare namespace Using System.ServiceProcess.ServiceBase.

How to add some information about our Service?
class Program : ServiceBase
{
  static void Main(string[] args)
  {
  }

  public Program()
  {
    this.ServiceName = "ERP";  //Here, User puts name of Service.
  }
  protected override void OnStart(string[] args)
  {
    base.OnStart(args);
    //TODO: place your start code here
  }

  protected override void OnStop()
  {
    base.OnStop();

    //TODO: clean up any variables and stop any threads
  }
}
Now, we implement Service for your Application. We create an Installer for your Application.

How to create installer for your Application?
   Create another Class for installer that is called “MyApplicationInstaller”.
 Assign a Class to Public Modifier like this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace
MyApplicationInstaller
{
  public class
MyApplicationInstaller
  {
  }
}
Add Two Class library for installer Class.
· System.Configuration.Install
· System.ComponentModel
System.Configuration.Install:
Provides classes that allow you to write custom installers for your own components.
System.ComponentModel:
Provides classes that are used to implement the run-time and design-time behavior of components and controls.

Now, we need to configure how we want to our Service installed.
[RunInstaller(true)]
public class MyApplicationInstaller: Installer
{
  public MyApplicationInstaller ()
  {
    var proInstaller = new ServiceProcessInstaller();
    var serInstaller = new ServiceInstaller();
   proInstaller.Account = ServiceAccount.LocalSystem;
   proInstaller.DisplayName = "ERP";
   serInstaller.StartType = ServiceStartMode.Manual;                        serInstaller.ServiceName = "ERP";
    this.Installers.Add(proInstaller);
    this.Installers.Add(serInstaller);
  }
}

Four Members of ServiceAccount in Windows Service:
1)  LocalService
2)  NetworkService
3)  LocalSystem
4)  User
LocalService:
An account that acts as a non-privileged user on the local computer.
NetworkService:
An account that provides extensive local privileges and any remote Services.
LocalSystem:
An account, used by the service control manager that has extensive privileges on the local computer and acts as the computer on the network.
User:
    An account defined by a specific user on the network.       

Three Members of ServiceStartMode:
1)  Manual
2)  Automatic
3)  Disabled

Manual:
Indicates that the service is started only manually, by a user
Automatic:
Indicates that the service is to be started (or was started) by the operating system, at system start-up
Disabled:
Indicates that the service is disabled, so that it cannot be started by a user or application.
Conclusion:
      I hope, this Article will get some ideas about Windows Services. Thanks for reading this article. Thanks to Google and MSDN.

List of WPF Controls based on .Net Framework version

Here, I give  a control name and .Net framework in WPF.

Control Name.Net Framework
· AccessText 3.0 ,3.5,4.0,4.5
· Border Control 3.0 ,3.5,4.0,4.5
· Button Control 3.0 ,3.5,4.0,4.5
· BulletDecorator Control 3.0 ,3.5,4.0,4.5
· Canvas Control 3.0 ,3.5,4.0,4.5
· Calendar Control 4.0,4.5
· CheckBox Control 3.0 ,3.5,4.0,4.5
· ComboBox Control 3.0 ,3.5,4.0,4.5
· ContextMenu Control 3.0 ,3.5,4.0,4.5
· Datagrid Control 4.0,4.5
· DatePicker Control 4.0,4.5
· DockPanel Control 3.0 ,3.5,4.0,4.5
· DocumentViewer Control3.0 ,3.5,4.0,4.5
· Expander Control 3.0 ,3.5,4.0,4.5
· FlowDocumentPageviewer Control3.0 ,3.5,4.0,4.5
· FlowDocumentReader Control3.0 ,3.5,4.0,4.5
· FlowDocumentScrollviewer Control3.0 ,3.5,4.0,4.5
· Frame3.0 ,3.5,4.0,4.5
· Grid Control 3.0 ,3.5,4.0,4.5
· GridView Control3.0 ,3.5,4.0,4.5
· GridSplitter Control3.0 ,3.5,4.0,4.5
· GroupBox Control3.0 ,3.5,4.0,4.5
· Hyperlink3.0 ,3.5,4.0,4.5
· Image Control3.0 ,3.5,4.0,4.5
· InkCanvas Control3.0 ,3.5,4.0,4.5
· InkPresenter Control3.0 ,3.5,4.0,4.5
· Label3.0 ,3.5,4.0,4.5
· ListView Control 3.0 ,3.5,4.0,4.5
· ListBox Control3.0 ,3.5,4.0,4.5
· Menu 3.0 ,3.5,4.0,4.5
· MediaElement3.0 ,3.5,4.0,4.5
· NavigationWindow3.0 ,3.5,4.0,4.5
· OpenFiledialog Control3.0 ,3.5,4.0,4.5
· PasswordBox Control3.0 ,3.5,4.0,4.5
· Panel Control3.0 ,3.5,4.0,4.5
· Page3.0 ,3.5,4.0,4.5
· PrintDialog Control3.0 ,3.5,4.0,4.5
· Popup3.0 ,3.5,4.0,4.5
· ProgressBar3.0 ,3.5,4.0,4.5
· RadioButton3.0 ,3.5,4.0,4.5
· Repeated Control 3.0 ,3.5,4.0,4.5
· ResizeGrip Control3.0 ,3.5,4.0,4.5
· RichTextBox Control3.0 ,3.5,4.0,4.5
· SaveFileDialog Control3.0 ,3.5,4.0,4.5
· Separator Control3.0 ,3.5,4.0,4.5
· ScrollBar Control 3.0 ,3.5,4.0,4.5
· ScrollViewer Control 3.0 ,3.5,4.0,4.5
· Slider3.0 ,3.5,4.0,4.5
· SoundPlayerAction3.0 ,3.5,4.0,4.5
· StackPanel Control3.0 ,3.5,4.0,4.5
· StrickNoteControl3.0 ,3.5,4.0,4.5
· StatusBar3.0 ,3.5,4.0,4.5
· TabControl3.0 ,3.5,4.0,4.5
· TextBlock3.0 ,3.5,4.0,4.5
· TextBox Control3.0 ,3.5,4.0,4.5
· Thumb Control 3.0 ,3.5,4.0,4.5
· ToolTip3.0 ,3.5,4.0,4.5
· ToolBar3.0 ,3.5,4.0,4.5
· TreeviewControl3.0 ,3.5,4.0,4.5
· Viewbox Control3.0 ,3.5,4.0,4.5
· VirtualizingStackPanel Control3.0 ,3.5,4.0,4.5
· Window Control 3.0 ,3.5,4.0,4.5
· WrapPanel Control3.0 ,3.5,4.0,4.5