Skip to main content

Posts

Showing posts from August, 2013

Generic Collection:Stack By:Tanuj Kumar

Stack<t>:  simple .net program to show working of stack collection. The System.Collections.Generic namespace contains interfaces and classes that define generic collections, which allow users to create strongly typed collections that provide better type safety and performance than non-generic strongly typed collections. An introduction to DOT NET: Generic collection: Stack Generic means it support specific data type (int,float string..etc)  Stack is LIFO Last in first out manner. Here stack is used to save data and retrieved it in LIFO manner. You can run program and see the working procedure of it. 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; namespace stackgenriccollection {     public partial class Form1 : Form     {         public Form1()         {             I

Event:Adding a button on run time: By:Tanuj Kumar

Event      Adding a button on run time: 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; namespace eventbuttonexample {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         private void Form1_Load( object sender, EventArgs e)         {             Button b1 = new Button ();             this .Controls.Add(b1);             b1.Location = new Point (50, 50);             b1.Size = new Size (100, 50);             b1.BackColor = System.Drawing. Color .Aqua;             b1.Text = "tanuj" ;             b1.Click += new EventHandler (a);         }         private void   a( Object sender, EventArgs e)         {   MessageBox .Show ( "button is clicked" );}      }} Adding

Event:Insert TextBox on RUN TIME By:Tanuj Kumar

Insert TextBox on RUN TIME:- Assignment1: 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; namespace eventassignment1 {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent ();         }         int a, b=100, c=100;         private void button1_Click( object sender, EventArgs e)         {                         a = int .Parse(textBox1.Text);             for ( int i = 0; i < a; i++) {                 TextBox tb = new TextBox ();                 this .Controls.Add(tb);                 tb.Location = new Point (b, c);                 b = b + 10;                 c = c + 10;             }         }     } } Posted By:Tanuj Kumar  On:Shareyourconscience

SortedList By:Tanuj Kumar

Sorted list Sortedlist: Represents a collection of key/value pairs that are sorted by the keys and are accessible by key and by index. An introduction to DOT NET: Add Adds an element with the specified key and value to a SortedList object. Clear Removes all elements from a SortedList object. Clone Creates a shallow copy of a SortedList object. Contains Determines whether a SortedList object contains a specific key. ContainsKey Determines whether a SortedList object contains a specific key. ContainsValue Determines whether a SortedList object contains a specific value. CopyTo Copies SortedList elements to a one-dimensional Array object, starting at the specified index in the array. 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.Collections; namespace sortedlistcollectionprog

Enabled multiple instance in Sql Server. By:Tanuj Kumar

You must have Sql server express installed in your system Step 1. Enabling User Instances on your SQL Server installation . First we are  make sure we have enabled User Instances for SQL Server 2005 installation. Go to Query Window in SQL Server Management Studio and type this: exec sp_configure 'user instances enabled', 1. Go Reconfigure execute this query Step 2. Deleting old files Now we need to delete any old User Instances. Go to your C drive and find and completely  DELETE  this path (and all files inside): C:\Documents and Settings\ YOUR_USERNAME \Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS After deleting this folder you can go to Visual Studio2008, create ASP.NET Web Site and click on your  App_Data  folder and choose Add New Item  and then choose  SQL Server Database2005  and it should work! Posted By:Tanuj Kumar  On:Shareyourconscience

MessageBox on closing event By:Tanuj Kumar

MessageBox on closing a form: MessageBox on closing event: private void Form1_FormClosing(object sender, FormClosingEventArgs e)                         {                              if (MessageBox.Show("Are You want To Close","Warning", MessageBoxButtons.YesNo) == DialogResult.No )                                                      {                                                                 e.Cancel = true;                                                          } Posted By:Tanuj Kumar  On: Shareyourconscience