Stack data structure in

By: Issac Emailed: 1697 times Printed: 2202 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Stack is another useful data structure in which is based upon push-pop method. It works on LIFO mechanism, the last value inserted will be the first one to be removed.

Syntax of Stack push and pop operations
Push: to add an item in the stack datastructure 
Syntax: Stack.Push (Object)
Pop: to return the item last inserted item in the stack 
Syntax: Stack.Pop ()
Return: the last object in the Stack 
Contains: to Check whether an object is in the stack or not
Syntax: Stack.Contains (Object)

VB.NET SourceCode 

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
If stackTable.Contains("4") Then
MsgBox("not exist")
End If
End Sub
End Class

When you run this program it numbers 1 to 7 (items) into the sack and then checks whether item “4” exists in the stack or not if it exists then the last item added is popped out(7 is popped out) if you check contains with 8 (i.e If stacktable.contains(“8”) ) then it will say not exist. Home | All Tutorials | Latest Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.

Bookmark and Share


1. View Comment

How about using stack in microprocessor subj.??? do you have any idea how to push and pop only???

View Tutorial          By: Private at 2015-08-18 01:43:18

Your name (required):

Your email(required, will not be shown to the public):

Your sites URL (optional):

Your comments:

More Tutorials by Issac
Save/Write/Read image file from/to a database using Java program
How to modify the objects using java classes
Java program for Cloning
Java program for changeable wrapper class
A tutorial on Chat Server and Chat Client in
Chat Server in
Chat client in
How to open and read an XML file in
How to create an XML file in
XML and
How to create an XML file in VB.NET using Dataset
Multi Threaded Client Socket Programming in
Multi Threaded Server Socket Programming in
Multi threaded Socket Programming in
Client Socket Program sample in

More Tutorials in
Scope in
Unstructured Exception Handling in
Structured Exception Handling in
Creating Sub Procedures in
Creating Functions in
Passing a Variable Number of Arguments to Procedures in
Specifying Optional Arguments with default values in Procedures in
Preserving a Variable's Values between Procedure Calls in
Procedure Delegates in
Properties in
Understanding Scope in
Using Resume Next and Resume Line in
Using On Error GoTo 0 in
Getting an Exception's Number and Description in
Raising an Exception Intentionally in

More Latest News
Most Viewed Articles (in )
Your first VB.NET Crystal Reports - A step by step guide
File operations in
Insert Background Pictures in Excel 2007 from VB.NET
Update cell data in an Excel file using OLEDB in
How to export from database to excel using
What's New in VB .NET? A comparison of VB vs
What is .NET Framework and the Common Language Runtime?
File Extensions Used in VB .NET
Visual Basic Statements
ArrayList data structure in
Stack data structure in
The text writer in binary reader and writer
How to Open and Edit Cells in an Excel 2007 file in VB.NET
To read the entire worksheet in an Excel workbook through Code
Most Emailed Articles (in
How to export from database to excel using
Changes in Controls from VB6 to
What is .NET Framework and the Common Language Runtime?
While Loop in
Substring in Vb.Net String Class
Create an Excel 2007 file in VB.NET 2005
Insert Pictures in Excel 2007 from VB.NET 2005
Socket Programming in
Chat Server in
Using the ServiceBase Class in
String Insert, index off & format in
String Split function in text reader
Using Excel 2007 Chart Picture Box
Using Excel 2007 DataBar in