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

Status of Service installed using C#

use this method for retrieving Service Installed or Not:
private static bool IsSerInstalled(string serviceName)
{
// get list of Windows services
System.ServiceProcess.ServiceController[] ser = ServiceController.GetServices();
// try to find service name
foreach (ServiceController service in ser)
{
if (service.ServiceName == serviceName)
return true;
}
return false;
}
Call this function/Method where do you want?
if (IsSerInstalled("AdobeFlashPlayerUpdateSvc"))
{
MessageBox.Show("Yes");
}
else
{
MessageBox.Show("No");
}
Result: "yes"

List of Windows Service using C#

Introduction A long running executable that's designed to work without user interaction.
It can be configured to start when the system boots and they can be run without any users logged into the system.
Get list of installed windows services ServiceContro­ller.GetServi­ces: get list of all services.
ServiceContro­ller.GetDevices: get list of driver services.
How to use in C#.net? · Create Project.
· Add Datagridview on the Form.
· Add “System.ServiceProcesss” using AddReference.
Add namespace:
using System.ServiceProcess;
Add Method:
void listofservice()
{
// get list of Windows services
System.ServiceProcess.ServiceController[] services = ServiceController.GetServices();
DataTable dt = new DataTable(); //add DataTable
DataColumn dc = dt.Columns.Add("ServiceName");
DataColumn dc1 = dt.Columns.Add("Display Service Name");
dc.Caption = "Service Name"; // set the caption
dc1.Caption = "Dispaly Service Name"; // set the caption
// try to find service name
foreach (ServiceController service in services)
{
dt.Rows.Add(service.ServiceName, service.Status);//add DataRow to DataTable by values
}
dataGridView1.DataSource = dt;
}
private void Form1_Load(object sender, EventArgs e)
{
listofservice();
}

Software Design Pattern

Introduction:
· A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
· Design patterns are recurring solutions to software design problems.
· Patterns are about design and interaction of objects, as well as providing a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges.
Use of Design Pattern: A design pattern helps you to find tested proven design paradigm to build a solid foundation for your project. So, if you follow design pattern you can easily prevent major issues to come while building your actual project. Moreover design pattern also helps the other architects to understand your code easily.
History of Design Pattern: Types of Design Pattern: · Creational patterns.
· Structural patterns.
· Behavioral patterns.
· Concurrency patterns.
Now, I am going to discuss few examples of patterns. They are
· Singleton Design Pattern.
· Factory Design Pattern.
· Factory Method Design Pattern.
· Abstract Factory Design Pattern.
· Builder Design Pattern.
· Adapter Design Pattern.
· Bridge Design Pattern.
· Composite Design Pattern.
· Flyweight Design Pattern. Singleton Design Pattern
Singleton pattern creates a class which can have a single object throughout the application,
Factory Pattern: A Factory is actually a creator of object which has common interface.
Factory Method Design Pattern: It creates the object of the class through interfaces but on the other hand, it also lets the subclass to decide which class to be instantiated.
Abstract Factory Design Pattern: It provides Factory interfaces for creating a family of related classes.
Builder Design Pattern: This pattern creates object based on the Interface, but also lets the subclass decide which class to instantiate.
Adapter Design Pattern: Adapter pattern actually makes two classes compatible.
Bridge Design Pattern: Bridge pattern compose objects in tree structure. It decouples abstraction from implementation.
Composite Design Pattern: Composite pattern treats components as a composition of one or more elements.
Flyweight Design Pattern: Flyweight allows you to share bulky data which are common to each object.

Application Architecture


Introduction:
                 In this Article, I explained about Application Architecture.
Overview:
·         Application Architecture.
·         Software Architecture.
·         Types of Application Architecture.

·         Definition of Application Architecture:
·         The applications architecture is specified on the basis of business requirements.
·         It involves defining the interaction between application packages, databases, and middleware systems in terms of functional coverage.
·         It is differed from Software architecture.
·         Definition of Software Architecture:
·         Software architecture is commonly defined in terms of structural elements and relationships.
·         Types of Application Architecture:
                            
1.    One Tier Architecture.
2.    Two Tier Architecture.
3.    Three Tier Architecture.
1.    One Tier Architecture:
·         One user can run on a Personal Computer.
·         The entire required components to run the application are located within it.
·         User interface, business logic, and data storage are all located on the same machine.
·         They are the easiest to design, but the least scalable.
2.    Two Tier Architecture:
·         It supplies a basic Network between Client and Server.
·         Improves scalability and divides the user interface from the data layers.
3.    Three Tier Architecture:
·         3 layers commonly known as: Presentation Layer (PL/UI), Business Logic Layer (BLL) & Data Access Layer (DAL).

One Tier Architecture:

2.    Two Tier Architecture:
 Three Tier Architecture:



VB.Net Hint -II

How to Create Variables in VB .NET?
A variable is a storage area of the computer's memory.
Eg:
Dim number1 As Integer
Dim
    Short for Dimension. It's a type of variable.your variable declarations with Dim.
number1
    This is a variable. In other words, our storage area.
As Integer
    We're telling Visual Basic that the variable is going to be a number (integer).
How to concanate two String in VB.Net?
Dim FirstName As String
Dim LastName As String
Dim FullName As String
FirstName = "Lakshmi"
LastName = "Naraayanan"
FullName = FirstName & LastName

& -- Symbol is used for Concanating strings.

What is the use of val Keyword n VB.net?
To convert text into Number.


VB.Net Hint - I

How to use Modules and Class method in the VB.Net?
First , we must know Modules and Class in the VB.Net.
Modules:
Modules are VB counterparts to C# static classes.
you don't want to allow inheritance and instantiation, you use a Module.
Class:
A class is a collection of objects of similar type. Once a class is defined, any number of objects can be created which belong to that class.
 Methods

A Method is a procedure built into the class. They are a series of statements that are executed when called.
 Sub Procedures
Sub procedures are methods which do not return a value. Each time when the Sub procedure is called the statements within it are executed until the matching End Sub is encountered.
Function is a method which returns a value. Functions are used to evaluate data, make calculations or to transform data. Declaring a Function is similar to declaring a Sub procedure. Functions are declared with the Function keyword.
Example call Module function  and Class methods
Here , i give a program for get splitting a string using function in VB.net
In vb.Net Function will return a value.

Module Module1
    Function splittingvalue(ByVal strigs As String, ByVal sr As Char) As String()
        Dim st As String() = strigs.Split(New Char() {sr})
        Return st
    End Function

Public Class Class1

    Public Shared Sub displaymessage()
        MessageBox.Show("Good Luck")
    End Sub

End Class

How to call Functions and Methods in the Application?
  Class1.displaymessage() // Method...
  Dim result As String() = Module1.splittingvalue("Lakshmi", "k") // Function
  Dim conResult = result(0) + result(1)
  MessageBox.Show(Convert.ToString(conResult))

Get Total Pages and Printer Name in C#.Net:



o   Create Project in the VS 2008.
o   Go To View Code.
o   Drop and Drop Two TextBoxs control into Design View.
o   Drop and Drop One Button control into Design View.
o   Add “System.Management” using  Add Reference
o   Put below Code in the Code Section.
o   Press “F5”.
o   See Result.





Get Printer name and Select Default Printer in C#.Net



o   Create Project in the VS 2008.
o   Go To View Code.
o   Drop and Drop listBox control into Design View.
o   Put below Code in the Code Section.
o   Press “F5”.
o   See Result.