Thursday 10 April 2014

Group Box and Picture Box in window form



                                                                                                                                            previous
                                                                                                                                               Next

Here i will explain use of  Group Box and Picture Box in window form.

GroupBox :- In a groupBox other controls we can placed like a login form. When designing interface in windowsForms, you can use this control to create shape.

drage and down a group box from tool box it will look like this.





PictureBox :- Picturebox provides a rectangular region for an image. It support multiple format of images.

Step(1): Login form
firstly create a login form with 2 lable and 2 textbox and 1 button.

Step(2): groupbox
Now drag down a groupBox and place these login form into groupbox by selecting this form (shift+click).





Step(3): PictureBox

Now drag down a PictureBox.






It will look like this and for getting picture click on sideBar option and select image




Now click Ok then you will show this picture in picturebox.

 Step(3): Run 
now run you application
                                                                                                                                            previous
                                                                                                                                               Next

Wednesday 9 April 2014

Password protection using Code

 
                                                                                                                                                Previous
                                                                                                                                                    Next

Here i will explain how we do password protection using code.

Step(1) :- Create a login Form

First create a Login form as i shown you in Tutorial 2
Step (2) :- Coding

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace First_Csharp_app
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            pass_txt.passwordChar = '$';    //without this you can also do it by text box property as password
        }

        private void button1_Click(object sender, EventArgs e)
        {
                 //Coding
       }

Step (3) :- Output
                                                                                                                                                Previous
                                                                                                                                                    Next

Tuesday 8 April 2014

Creating Login Form with Sql Server in window form

                                     
                                                                                                                                     Previous
                                                                                                                                           Next

Here i will explain a how to create a login form with Sql Server. before this i explain that to connect window form with database(sql server).

Step(1):  login form
 drag and down two lable (for username and password) and two text box and a button(submit) on window form and change their name as  usrtxt and passtxt.

Step(2):database table

Step(3): Coding on button click
click on button and write this coding

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace First_Csharp_app
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (!(usertxt.Text == string.Empty))
                {
                    if (!(passtxt.Text == string.Empty))
                    {
                        String str = "server=MUNESH-PC;database=windowapp;UID=sa;password=123";
                        String query = "select * from data where username = '" + usertxt.Text + "'and password = '" +this.passtxt.Text + "'";
                        SqlConnection con = new SqlConnection(str);
                        SqlCommand cmd = new SqlCommand(query, con);
                        SqlDataReader dbr;
                        con.Open();
                        dbr = cmd.ExecuteReader();
                        int count = 0;
                        while (dbr.Read())
                        {
                            count = count + 1;
                        }
                        if (count == 1)
                        {
                            MessageBox.Show("username and password is correct");
                        }
                        else if (count > 1)
                        {
                            MessageBox.Show("Duplicate username and password""login page");
                        }
                        else
                        {
                            MessageBox.Show(" username and password incorrect""login page");
                        }
                    }
                    else
                    {
                        MessageBox.Show(" password empty""login page");
                    }
                }

                else
                {
                    MessageBox.Show(" username empty""login page");
                }
                // con.Close();

            }
            catch (Exception es)
            {
                MessageBox.Show(es.Message);

            }
        }
    }
}
Step(3): Run your application
if username and password is not correct
if username and password is correct



                                                                                                                                     Previous
                                                                                                                                           Next

Window Form/Window application Tutorial

.

Connect sql server with windows application

In This tutorial we will learn how to connect sql server with windows application

Create a login form with Sql Server

Here we will learn how to create a login form with Sql Server

Password protection using code.

In This tutorial we will learn how we do password protection using code.

Use of Group Box and Picture Box in window form.

Here we will learn how to use of Group Box and Picture Box in window form.

Open second from using first form in window form

In This tutorial we will learn how to open second from using first form in window form

Insert data into dataBase in window form application

Here we will learn how Insert data into dataBase in window form application

Edit And Update data from database in window form.

In This tutorial we will learn how Edit and Update data from database in window form.

Delete data from database in window form

Here we will learn how to Delete data from database in window form

Use of comboBox in windows form

In This tutorial we will learn how to Use of comboBox in windows form

How to Link combobox with database

Here we will learn how to Link combobox with database

Database values in textbox if select Combobox in window form

In This tutorial we will learn Database values in textbox if select Combobox in window form

Link list box with DataBase in window form

Here we will learn how to Link list box with DataBase in window form

Database value in textBox if selected in listbox in window form

In This tutorial we will learn Database value in textBox if selected in listbox in window form

Show database value in DataGridView in window application

Here we will learn how to Show database value in DataGridView in window application

How to use chart graph in window appliaction

In This tutorial we will learn How to use chart graph in window appliaction

How to link chart Graph with database in window form

Here we will learn How to link chart Graph with database in window form

Dynamically display Current date and time in window form

In This tutorial we will learn How to Dynamically display Current date and time in window form

How to use progressBar and button in window appliaction

Here we will learn How to use progressBar and button in window appliaction

How to Exit from this application

In This tutorial we will learn How to Exit from this application

Change column title of datagridview

Here we will learn How to Change column title of datagridview

Display selected Row from datagrid view to textBoxes

In This tutorial we will learn How to Display selected Row from datagrid view to textBoxes in windows application

How to use CheckBox and redio Button in window form

Here we will learn How to use CheckBox and redio Button in window form

How to use DateTime Picker and save in databas

In This tutorial we will learn How to How to use DateTime Picker and save in databas in windows application

How to use OpenFile Dialog and Copy that path

Here we will learn How to use OpenFile Dialog and Copy that path

Open File Text into TextBox and Rich TextBox

In This tutorial we will learn How to Open File Text into TextBox and Rich TextBox

Search_Highlight text in TextBox or richTextBox

Here we will learn How to Search_Highlight text in TextBox or richTextBox

Create a Text File and write in it in window application

In This tutorial we will learn How to Create a Text File and write in it in window application

Create Excel(.XLS and .XLSX) file from C# using excellibrary

Here we will learn How to Create Excel(.XLS and .XLSX) file from C# using excellibrary in windows application

How to export data from database to Excel file

In This tutorial we will learn How to export data from database to Excel file

How to import Excel File to DataGridView

Here we will learn How to import Excel File to DataGridView

How to Open and show a PDF file inside the form

In This tutorial we will learn How to Open and show a PDF file inside the form

How to launch any (_exe) file in any directory

Here we will learn How to launch any (_exe) file in any directory

Make application to beep and How to add a delay in second

In This tutorial we will learn to Make application to beep and How to add a delay in second

How to play a audio file in window application

Here we will learn How to play a audio file in window application

Random Number Generator within range

In This tutorial we will learn how to Generat Random Number within range

How to use and connect Sqlite in a window application

Here we will learn How to use and connect Sqlite in a window application

How to add a (window media palyer) video clip to the form

In This tutorial we will learn How to add a (window media palyer) video clip to the form

MP3 media Player in window application

Here we will learn How to create MP3 media Player in window application

How to load image in picture Box from computer

In This tutorial we will learn How to load image in picture Box from computer

Save Image in database

Here we will learn How to Save Image in database

Retrieving Image from database in window application

In This tutorial we will learn How to Retrieving Image from database in window application

C# program Selection Sorting

Selection sort is a straightforward sorting algorithm. This algorithm search for the smallest number in the elements array and then swap i...