Vb.Net-Informations.com

  How to VB.Net Stack




   Categories

    HOME
    VB.NET
    CSHARP

 
   














How to VB.Net Stack

Stack is one of another easy to use VB.NET Collections . Stack follows the push-pop operations. That is we can Push Items into Stack and Pop it later . And It follows the Last In First Out (LIFO) system. That is we can push the items into a stack and get it in reverse order. Stack returns the last item first.

Commonly used methods :

Push : Add (Push) an item in the stack datastructure

Syntax : Stack.Push(Object)

Object : The item to be inserted.

Pop : Pop return the item last Item to insert in stack

Syntax : Stack.Pop()

Return : The last object in the Stack

Contains : Check the object contains in the stack

Syntax : Stack.Contains(Object)

Object : The specified Object to be seach

The following VB.NET Source code shows some of commonly used functions :


         VB.NET Source Code Download           Print Source Code
         How to VB.Net Stack - Download
        
VB.Net Tutorial

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, 
	ByVal e As System.EventArgs) Handles Button1.Click
        Dim stackTable As New Stack
        stackTable.Push("Sun")
        stackTable.Push("Mon")
        stackTable.Push("Tue")
        stackTable.Push("Wed")
        stackTable.Push("Thu")
        stackTable.Push("Fri")
        stackTable.Push("Sat")
        If stackTable.Contains("Wed") Then
            MsgBox(stackTable.Pop())
        Else
            MsgBox("not exist")
        End If
    End Sub
End Class
		

When you execute this program add seven items in the stack . Then its checks the item "Wed" exist in the Stack. If the item exist in the Stack , it Pop the last item from Stack , else it shows the msg "Not Exist"

VB.NET Collections Related Contents
*     How to use VB.NET ArrayList
*     How to use VB.NET HashTable
*     How to use VB.NET Queue
*     How to use VB.NET Arrays
*     How to use VB.NET Dyanamic Arrays
*     How to use VB.NET NameValueCollection

VB.Net Related Topics
*     Microsoft .Net Framework Tutorials
*     VB.NET Language Basics Tutorials
*     VB.NET Program Flow Control Tutorials
*     VB.NET Collections Tutorials
*     VB.NET String Tutorials
*     VB.NET Files Tutorials
*     VB.NET Excel 2007 Tutorials
*     VB.NET Crystal Reports Tutorials
*     VB.NET Communications Tutorial
*     VB.NET ADO.NET Tutorial with source code
*     ADO.NET Data Providers help and Tutorial
*     VB.NET ADO.NET Dataset Tutorial
*     ADO.NET DataAdapter and Dataset
*     VB.NET ADO.NET DataView Tutorial
*     VB.NET Remoting Tutorial
*     VB.NET XML Tutorial
Search here for more CSharp Source Code :

  |  Home   |  SiteMap   |  About   |
net-informations.com (C) 2010 All Rights Reserved