Tuesday, November 25, 2014

How to insert values in Microsoft Excel rows and column at once

Have you ever come across Excel sheet  where you need to insert value in the blank cell .
Suppose you have a excel sheet with values and you need to fill "NULL" in the remaining cells



In the above figure if you need to fill "NULL" in the remaining cells

1. Select the range where you want to fill the values



2. In "Find & Select" Click on "Go ToSpecial..."


3. The below window will appear. Click on Blanks and then click "OK"


4. The Range cells will be selected and will appear in color blue and one cell will be selected to enter text. in the figure it is A1 cell

5. Don't click anywhere just type text NULL and the press Control + Enter . All the selected cells will have the text NULL




Video that demonstrates the above with an example




Saturday, September 27, 2014

How to create Database in SQL Management Studio


In this section I will show you how to create Database in SQL Management Studio

1-      Open SQL Management Studio

2-      Go to Object Explorer (View à Object Explorer)



3-      Right Click on the Databases and click on New Database…
                    

4-      You will get the New Database Window. In the General Section write the name of the database in the Database name:
Here I have given TestDB.



5-      You can change the physical location of the database by clicking on the button in the path column of Database files

By default it is C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\

6-      Click on OK button

 

7-      The TestDB Database appears in the Databases in the Object Explorer
 

Thursday, August 28, 2014

Introduction to XAML

Introduction to XAML

  1.  XAML is a defined as Extensible Markup Language whose primary role is in the creation of .Net Objects.
  2. XAML is a declarative Markup language based on XML. A declarative language is one that describes what it is required but not how the requirement will be met (eg: HTML is a declarative languague that describes what should be displayed on a webpage. Similarly XAML can be used as a means of describing objects)
  3. Although it is used mainly in Windows Presentation Foundation (WPF), However it can be used in WF, Sliverlight and XPS technologies.
    1. WF: WF creates Workflows and XAML is used to define the structure of Wokflows including conditions and rules
    2. Sliverlight: Sliverlight is a tool for creating rich internet application and uses XAML to construct and initiate
    3. XPS: XAML is used in XPS for formatted electronic documents

Important points of XAML
XAML is a DECLARATIVE langauage
XAML is designed to be in CONJUNCTION WITH WPF
XAML is used to DESCRIBE A TREE OF .NET OBJECTS IN WPF
XAML is a tool that can BE USED IN CONJUNCTION WITH OTHER TECHNOLOGIES
XAML targets A SUBSET of .Net Namespaces
XAML displays its data in a HIERARCHICAL fashion
XAML uses XML namespaces
XAML is complied into BAML at runtime
XAML Elements represents System.Windows Namespaces classes in wPF

Saturday, August 23, 2014

How to display PDF in WPF application



Create a new WPF project
  1. In the design mode of the Mainwindow.xaml. Add button control and WindowsFormHost Control in the MainWindow.xaml
<Window x:Class="DemoPDFView.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="619" Width="700">
    <Grid>
        <Button Name="Btn1" Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="126,27,0,0"/>
        <WindowsFormsHost Name="WFH1" HorizontalAlignment="Left" Height="430" VerticalAlignment="Top" Width="492" Margin="10,69,0,0"/>

    </Grid>
</Window>
  1. Now Add a UserControl by clicking on Add New Item in the solution Explorer



Go to the design Mode: In the design view of UserControl
  1. Right Click on the tool box and Click on “Choose Items”

  1. You will get the following “Choose Toolbox Items” window. Go to “COM Components” Tab  and check “Adobe PDF Reader” and click on “OK”

  1. You will now find the adobe control in the tool boxes.


 Add the Adobe PDF Reader(axAcroPDF1)control in the form.



Set the width and height properties of the axAcroPDF1 control same as WindowsFormsHost control
That is



In the code behind file Copy and paste the code below InitializeComponent();
Add the line this.axAcroPDF1.LoadFile(filename);
Your userControl class should look like this
public partial class UserControl1 : UserControl
    {
        public UserControl1(string filename)
        {
            InitializeComponent();
            this.axAcroPDF1.LoadFile(filename);
        }
    }

Now in the code behind file of MainWindow.xaml  add the code for the Btn1 button event 

  private void Btn1_Click(object sender, RoutedEventArgs e)
        {
            // Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = "Document"; // Default file name
            dlg.DefaultExt = ".pdf"; // Default file extension
            dlg.Filter = "pdf files (*.pdf) |*.pdf;"; // Filter files by extension

            // Show open file dialog box
            Nullable<bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string filename = dlg.FileName;
                var uc = new UserControl1(filename);
                this.WFH1.Child = uc;
            }
        }

OUTPUT:




Tuesday, August 19, 2014

How to display PDF documents in Windows applications(C# and VB.Net)



To display PDF in Windows Application:
  1. Start a new Windows Project
  2. Right Click on the tool box and Click on “Choose Items”

  1. You will get the following “Choose Toolbox Items” window. Go to “COM Components” Tab  and check “Adobe PDF Reader” and click on “OK”

  1. You will now find the adobe control in the tool boxes.

  1. In the Design View Drag and drop Adobe PDF reader Control and a Button Control

On the button click event add the following code:

VB.Net code

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim dlg As OpenFileDialog
        dlg = New OpenFileDialog()
        dlg.Filter = "pdf files (*.pdf) |*.pdf;"
        dlg.ShowDialog()
        If (Not String.IsNullOrEmpty(dlg.FileName)) Then
            AxAcroPDF1.LoadFile(dlg.FileName)
        End If
     End Sub


C# .Net Code

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "pdf files (*.pdf) |*.pdf;";
            dlg.ShowDialog();
            if(dlg.FileName != null)
            {
                axAcroPDF1.LoadFile(dlg.FileName);
            }

        }

Output: