-->

Tuesday, November 12, 2013

Windows Store:How to Add item in GridView

  1. Add a GridView control to a parent container using XAML code editor with name attribute.
<GridView x:Name="GridView1" >           

</GridView>

To assign a name to the grid view, set the x:Name attribute to a string value. To refer to a control in code, it must have a name. Otherwise, a name is not required.

2. Add items to the grid view by populating the Items collection or by binding the ItemsSource property to a data source.
 
<GridView x:Name="GridView1" > 
<x:String> name </x:String>
<x:String> City </x:String>          

</GridView>

Start Screen

Windows Store:How to Add item in GridView
 
Windows Store:How to Add item in GridView
 

Apply II method in code file

1. Create a List of String Items and bind with GridView control in main file constructor.
 

public MainPage()

{

 

this.InitializeComponent();

List<String> itemcoll = new List<String>();

itemcoll.Add("Apple");

itemcoll.Add("Mango");
itemcoll.Add("Orange");

GridView1.ItemsSource = itemcoll;

}

 

Sunday, November 10, 2013

How to set PictureBox Image using OpenFileDialog or Bitmap Class: WindowsForms

A person’s basic properties are name, age, date of birth, contact no. and also have a picture of that person. To insert the picture we have to preview that picture at the same time we are loading the picture. That’s why we need this picture box control on the windows forms.

Picture Box control is used to display pictures that may be jpeg, jpg, png or any bitmap file. The picture can be set during run time by the user, or can be fixed by the programmer during design time. It have many properties to be used by the programmer, to make the picture adjustable.
Picture box have some common properties that are mostly used by, which are:

  • SizeMode: used to control the clipping and positioning of the image in the display area.
  • ImageLocation: specify the image to be displayed.
  • ClientSize: used to change the size of the display area at run time.
  • BorderStyle: to distinguish the control from the rest of the form, even it have no image.

Drag-n-drop a picture box which will hold the image and button to be used to browse the image. The form will look like the image below:

How to set PictureBox Image using OpenFileDialog or Bitmap Class: WindowsForms

Generate the click event of button and write the following C# code:
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();
pictureBox1.ImageLocation = ofd.FileName;
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;

When you run this project and click on the button, it will show an openFileDialog box. You have to select an image file and click on OK button. At the last the picture has been set on the picture box as shown in the below image.

How to set PictureBox Image using OpenFileDialog or Bitmap Class: WindowsForms

It is not required to set the picture as above, we can set an object also of the Image class in the System.Drawing namespace. For that, just create an object of Bitmap class and set that object to the image property of picture box, as described in the below code:
Bitmap bt = new Bitmap(“image path”);
pictureBox1.Image = bt;
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;

The most thing to be noticed in the second code, is we have to know the exact path of the image file. Run the code and it will give the same output as the first code provide.

See Also: OpenFileDialog in windows forms

Saturday, November 9, 2013

Attendance Management Project in Windows Forms with C#

Download this project

Project cost : 300Rs or $10
Pay me at:


Via bank transfer

 
ICICI bank account number is :    153801503056
Account holder name is :                 Tarun kumar saini
IFSC code is :                                   ICIC0001538

SBBJ bank detail :                             61134658849
Account holder name:                        Tarun kumar saini
IFSC code :                                        SBBJ0010398

CONTACT ME

Introduction

All the institutions are following almost the same procedure of storing the attendance of student i.e. registers or may be an excel file. When counting the attendances at the last they have to manually count for each student, or by insertion of some formula in excel file.

Attendance management project will simply provide all the common features, it should have. Through this project one can add new student, assign them attendances monthly and at the last a report can also be generated as a hard proof. The person, know the username and password, can only be permissible to use this software.

The solution have another class library project that is used to create the database using entity framework. Database has only two tables i.e. Attendance and Student, each have its own field.

Features of Project: 


  • Administrator can only login into the software.
  • User can add/modify student’s details as per the requirements.
  • Can search attendance according to either student name or roll no.
  • A report can be generated at the last as a proof for guardian/parents.

System Requirements:



  • Visual Studio 2010 or higher
  • SqlServer 2008 or higher
  • DotNet Framework 4.0 or higher (pre-loaded with Visual Studio)

Run the project:

It is a windows form application, so either press F5 or click on Start button. It will load the login window, which requires username and password. Username is “admin” and password is “password”, click on login button and the manage options window will be shown to you.

Screenshots:
New Attendance: The form through which the user can add attendance according to the roll no.

Attendance Management Project in Windows Forms with C#

Attendance List: Let the user search the attendance according to the student name.
Attendance Management Project in Windows Forms with C#

Attendance via RollNo: User can count attendance via roll no of the student.

Attendance Management Project in Windows Forms with C#

Report Form: The form will show you how the report will look like, you can change this design using the report window.

Attendance Management Project in Windows Forms with C#

If you want to purchase this please contact me on :  narenkumar851@gmail.com

Read Also:
  Lab Digitization Project

Binding Data with BindingNavigator in Windows Forms

There are some steps to bind the data with DataSet object. Theses steps are
Step-1: Create a Windows Form.
Step-2 : Add Binding Navigator and control (Three Label control and Three TextBox control) on the form
Controls and binding navigator on the windows form
Step-3: Right Click on First TextBox and select properties .
Step-4: Select "Add project data source " link  in Text property of (DataBindings) tab.
"Add project data source " link  in Text property of (DataBindings) tab

Step-5: Now open Data Source configuration wizard.
Step-6: Select Database in configuration wizard and click next button.
Select Database in configuration wizard

Step-7 : Select DataSet in Database model and click next.
Select DataSet in Database model

Step-8:  Choose your Data Connection and create connection string.
Data Connection and create connection string.
Step-9: Choose Database object which you want like Table,View etc.
 Database object which you want like Table,View
Step-10: Click to Finish Button.
Step-11: In connected data source select single field or column which you want to connect with first TextBox.
DataBinding in windows form

Step-12: Similarly bind city and country with remaining TextBox control.
Step-13: Set BindingSource property of the BindingNavigator is given DataSet.
Step-14: Run your application.
Binding Data with BindingNavigator in Windows Forms

Binding Data with BindingNavigator in Windows Forms

Friday, November 8, 2013

Lab Digitization Project in Windows Forms with C#

Download this project

Project cost : 300Rs or $10
Pay me at:


Via bank transfer

 
ICICI bank account number is :    153801503056
Account holder name is :                 Tarun kumar saini
IFSC code is :                                   ICIC0001538

SBBJ bank detail :                             61134658849
Account holder name:                        Tarun kumar saini
IFSC code :                                        SBBJ0010398


CONTACT ME

Introduction:

In Colleges and Schools all the labs are following the same procedure to giving the task to students. They write that assignment on the board, students get/copy that and do that in the computer. What if there will be a software in which teacher save the assignment and when student login into the software, the assignment is opened by default.

Lab Digitization is a windows application which stores all the tasks to perform by students and load the current task to be perform. Only the specified tutor can check the related task done by students that’s why it is secure to check the files on computer.

The important thing of this software is: after a time period, student can’t check the tutor’s task and he/she will not be eligible to do that assignment. Each task entry usually consist of some fields i.e. tutor filename, start time and end time.

Features of Project: 


  • Tutor and student can only login with their respective credentials.
  • Only tutor can save an assignment. 
  • Related tutor can add/edit student’s details and check all the files submitted by the students
  • Student can only read its current assignment and can submit its own answer.

System Requirements:


  • Visual Studio 2010 or higher
  • SqlServer 2008 or higher
  • DotNet Framework 4.0 or higher (pre-loaded with Visual Studio)

Run the project:

It is a windows form application, so either press F5 or click on Start button. It will load the login window, which requires username and password. For Tutor username is “admin” and password is “password”, click on login button and the manage options window will be shown to you.

And for the student its name and rollno is required and after login student only read its current assignment and submit its answer only once.

Screenshots:

Tutor Login
Lab Digitization Project in Windows Forms with C#

Student Login
Lab Digitization Project in Windows Forms with C#

TutorList: Contains the list of tutors stored in the database.
Lab Digitization Project in Windows Forms with C#

TutorFileOptions: where user can save its file with start time and end time and date. Student can only open that file in-between the given time.
Lab Digitization Project in Windows Forms with C#

There are some more forms like student workplace, student file check and etc, that can be used by downloading the project.

If you want to purchase this please contact me on :  narenkumar851@gmail.com

How to get name of users in ASP.NET

Introduction

Get the name of the person who is active in the windows environment. ASP.NET provides simple property for this type of query. Use UserName property of the Environment class which is reside in System namespace.

Application of the property is


  • Divide the application in different users also check who is online in current thread.

Example

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = Environment.UserName; ;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <span style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">
        Get the name of the person who is active in the windows environment.<br />
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
            Text="Get user name" Width="135px" />
        <br />
        <br />
        <asp:Label ID="Label1" runat="server"></asp:Label>
        <br />
        </span>
   
    </div>
    </form>
</body>
</html>

OUTPUT
How to get name of users in ASP.NET

Thursday, November 7, 2013

Advantages of XML

Some of the advantages of XML are:


  • Domain-specific vocabulary
  • Data interchange
  • Smart searches
  • Granular updates
  • Users-selected view of data
  • Message transformation

Domain - Specific Vocabulary

HTML uses a set of predefined tags to present data in various formats. While working with HTML, you are restricted to the use of only these tags. On the other hand, XML does not have any predefined tags. You can create new tags based on the requirerments of the application, that is, you can create domain-specific vocabulary in XML.

Consider the following HTML code snippet:

 
      <B> My Book </B>
      <p>
               john smith <br>
               Tech books publications <br>
               $30.00<br>
    </p>
The preceding code snippet represents information about the author, publisher, and cost of a book. However, the tags used for presenting this content do not reveal this information. The tags specify the format in which the content must be displayed on a browser. The same information can be represented in XML as:

        <Book>
               <NAME> My Book </NAME>
               <AUTHOR> John smith </ AUTHOR>
               <PUBLISHER> tech books publications </PUBLISHER>
<PRICE>$30.00</PRICE>
</BOOK>
In the preceding code snippet, the content is described by using meaningful tags to represent the data. XML enables you ti create a markup language for your application and does not place any restriction on the number of tags that you can define. There are several languages derived from XML, such as MathML, which is a markup language used for the representation of mathematical formulae and scientific data, and Wireless Markup Language(WML), which is used for Web Applications that can be accessed by using a cellular phone.

Data Interchange

Data interchange is essential to carry out business transactions. You need to establish standard interfaces among related enterprises in which the data is stored is disparate forms to facilitate data interchange. XML produces files that are unambiguous, easy to generate, and easy to read. It provides a structure to store data in textual format, which can then be used as a standard format or protocol for data interchange. This eliminates the differences in the system that exchange data.

Smart Searches

Although HTML provides you with a set of predefined tags, it is difficult to implement a search on an HTML document. for example, consider the following code snippet in HTML :

The best picture award in 1999 went to the film <b> Titanic. </b> This film was based on the story of a ship called <b> Titanic.</b>

In the preceding code snippet, the search engine will not be able to determine whether you are referring to Titanic as a ship, a play, or a film. If you specify a search for the next Titanic within the tags <b> </b>, then the search will return all the words matching Titanic within the <b> and </b> tags.
The flexibility to create user-defined tags in XML enables you to create smart search engines. For example, consider the following code snippet:

The best picture award in 1999 went to the film
<FILM> Titanic.</FILM>
This film was based on the story of a ship called.
<SHIP>Titanic.</SHIP>

In the preceding code snippet, it is very clear that Titanic is a reference to a film by that name. When you perform a search, you can specify that the search needs to be performed for the text Titanic within the <FILM> and </FILM> tags. This enables the browser to perform a focused search and return precise information that matches the search query.

Granular Updates

 Document updates in HTML are slow as the entire document needs to be refreshed from the server. In comparison with this, only the changed content needs to be downloaded in XML documents, thus making updates faster. For example, if you need to update stock prices on a Web page, it will take more time to update an HTML document, as the entire page would have to be reloaded. With XML, only the prices can be updated.

User -Selected View of Data

In HTML, you need to create separate HTML pages to display the same information in different formats. This is because an HTML page contains data, as well as, instructions to the browser for the presentation of data. On the other hand, XML concentrates on the data and not on its presentation. You can display XML document in the required format by using Cascading Style Sheets(CSS) and Extensible Style Sheet Language (XSL). This separation of data from its presentation has various advantages. For example, you can download an XMl document once and reply different formatting styles by using CSS or XSL.
A user can select one, several, or all records, and sort by different attributes, format data based on a condition, or switch to the graphical view without requesting the XML document from the server for each operation. The same data can be presented differently, perhaps as a subset, depending on the viewer's role with respect to the data. For example, the account department my be able to access financial information, whereas a buyer may not be able to access the same information.

HTML does not allow conditional formatting of a document. For example, it is not possible using HTML to display the name of the product with the highest sales figure in green and the lowest sale figure is red. You can implement conditional formatting of data by using XML.

Message Transformation 

In XML, a message ca be stored in the form of a document, object data, or data from a database. XML message are designed in such a way they reflected the information content and not the intended use of the messages. XML design provides flexibility while storing data as it does not impose any restriction o the field size and the order in which the data is stored. Data can be extracted based on the needs of the client application.
© Copyright 2013 Computer Programming | All Right Reserved