Posts

Showing posts from May, 2013

Create a console based link in C#

Image
Create a console based  link in C#

Create a console based application that has following features:
1.Create a class to store student information (First Name, Last Name, Major, Section) 2.Populate an ArrayList of students class objects for 10 students. 3.Using LINQ to Objects, retrieve all students belonging to section 5A and display on the console. 4.Using LINQ to SQL, insert these records into a table in a database.
5.Verify that they are stored in the database by retrieving these records using LINQ to SQL and displaying on the console.
Code
using System;
using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.Data.Linq; using System.Data.Linq.Mapping; using System.Data.SqlClient; using System.Data;
namespace lab_12 { classProgram     { staticvoid Main(string[] args)         { ArrayList obj_arr = newArrayList();             obj_arr.Add(newcstudent("Shoaib","Malik","Computer",'A'));             obj_arr.Add(newcstudent…

How to make own custom control in C#

Image
How to make own custom control in C#

Create a Login control that has following features: 1.Login Id and Password entry fields along with Login button 2.Database validation feature for Login Id and Password 3.Properties for database name, table name and any thing else to validate against
Test your control.

Code
using System;
using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient;
namespace lab11 { publicpartialclassUserControl1 : UserControl     { public UserControl1()         {             InitializeComponent();         } privatestring v_Database_Name, v_Table_Name, v_Column_ID, v_Column_Password; publicstring Database_Name         { get             { return(v_Database_Name);             } set

How to make simple cricket application in C#

Image
How to make simple cricket application in C#
Create a class that keeps the updated cricket score in terms of runs, wickets and overs, and has a method that calculates the run-rate and saves it in a separate field. Serialize this class but do not serialize the run-rate field.
Create an application that allows user to display the current score and the run-rate and also allows updating the serializable fields. If running for the first time, when no score is available, the user should be able to input the current score.
Test your application using both types of Formatters, Binary and SOAP for serializing the object. Observe and attach the generated .bin and .xml files



Code
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Soap; using System.Runtime.Serialization.Formatters.Bi…

XML Document Object Model (DOM)

Image
 XML Document Object Model (DOM)

Develop a Windows Forms application that does following: 1.Reads the sample .xml file (given above) and displays its contents in a Label control. 2.Displays all the titles (for books) in a ListBox control.  .Deletes the book for the selected title from the ListBox. (use a delete button)
4.Append a complete book element to the .xml file (use text boxes to enter values)
Sample XML File
<?xml version="1.0"?>   <bookstore>     <book>       <title>World History</title>       <publisher>MSPress</publisher>       <authors>         <author>Carson</author>       </authors>     </book>     <book>       <title>C++ for Dummies</title>       <publisher>Prentice Hall</publisher>       <authors>         <author>A. Levine</author>         <author>B. Levine</author>       </authors>     </book>     <book>       <title>Cooking Tips…