simulasi stack dengan vb.net

selamat malam sahabat blogger...
kali ini saya mempostingkan tentang program stack dengan menggunakan VB.net 2008
di bawah ini merupakan listing programnya
selamat mencoba














Public Class Form1
   
    Private m_stack As New Collections.Stack
    Private Sub tampilstack()
        Dim value() As Object = m_stack.ToArray()
        Dim txt As String
        For i As Long = 0 To value.GetUpperBound(0)
            txt = value(i) & " "
        Next i
        tmppush.Text = txt
    End Sub
    Private Sub pushh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pushh.Click
        m_stack.Push(txtinput.Text)
        txtinput.Text = Chr(Asc(txtinput.Text) + 1)
        txtinput.Select(0, 0)
        tampilstack()

    End Sub
    Private Sub popp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles popp.Click
        tmpop.Text = m_stack.Pop() & " " & tmpop.Text
        tampilstack()
    End Sub
   
End Class