Option Strict Off
Option Explicit On

Friend Class Tokenshow
  Inherits System.Windows.Forms.Form

#Region "Windows Form Designer generated code "
  Public Sub New()
    MyBase.New()
    If m_vb6FormDefInstance Is Nothing Then
      If m_InitializingDefInstance Then
        m_vb6FormDefInstance = Me
      Else
        Try
          'For the start-up form, the first instance created is the default instance.
          If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
            m_vb6FormDefInstance = Me
          End If
        Catch
        End Try
      End If
    End If
    'This call is required by the Windows Form Designer.
    InitializeComponent()
  End Sub
  'Form overrides dispose to clean up the component list.
  Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
    If Disposing Then
      If Not components Is Nothing Then
        components.Dispose()
      End If
    End If
    MyBase.Dispose(Disposing)
  End Sub
  'Required by the Windows Form Designer
  Private components As System.ComponentModel.Container
  Public ToolTip1 As System.Windows.Forms.ToolTip
  Public WithEvents lsTokens As System.Windows.Forms.ListBox
  Public WithEvents Tokenize As System.Windows.Forms.Button
  Public WithEvents txString As System.Windows.Forms.TextBox
  Public WithEvents Label1 As System.Windows.Forms.Label
  'NOTE: The following procedure is required by the Windows Form Designer
  'It can be modified using the Windows Form Designer.
  'Do not modify it using the code editor.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container()
    Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
    Me.ToolTip1.Active = True
    Me.lsTokens = New System.Windows.Forms.ListBox()
    Me.Tokenize = New System.Windows.Forms.Button()
    Me.txString = New System.Windows.Forms.TextBox()
    Me.Label1 = New System.Windows.Forms.Label()
    Me.Text = "Show tokenizer"
    Me.ClientSize = New System.Drawing.Size(312, 213)
    Me.Location = New System.Drawing.Point(4, 23)
    Me.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultLocation
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.BackColor = System.Drawing.SystemColors.Control
    Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable
    Me.ControlBox = True
    Me.Enabled = True
    Me.KeyPreview = False
    Me.MaximizeBox = True
    Me.MinimizeBox = True
    Me.Cursor = System.Windows.Forms.Cursors.Default
    Me.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.ShowInTaskbar = True
    Me.HelpButton = False
    Me.WindowState = System.Windows.Forms.FormWindowState.Normal
    Me.Name = "Tokenshow"
    Me.lsTokens.Size = New System.Drawing.Size(121, 124)
    Me.lsTokens.Location = New System.Drawing.Point(136, 80)
    Me.lsTokens.TabIndex = 3
    Me.lsTokens.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
    Me.lsTokens.BackColor = System.Drawing.SystemColors.Window
    Me.lsTokens.CausesValidation = True
    Me.lsTokens.Enabled = True
    Me.lsTokens.ForeColor = System.Drawing.SystemColors.WindowText
    Me.lsTokens.IntegralHeight = True
    Me.lsTokens.Cursor = System.Windows.Forms.Cursors.Default
    Me.lsTokens.SelectionMode = System.Windows.Forms.SelectionMode.One
    Me.lsTokens.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.lsTokens.Sorted = False
    Me.lsTokens.TabStop = True
    Me.lsTokens.Visible = True
    Me.lsTokens.MultiColumn = False
    Me.lsTokens.Name = "lsTokens"
    Me.Tokenize.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
    Me.Tokenize.Text = "Tokenize"
    Me.Tokenize.Size = New System.Drawing.Size(65, 33)
    Me.Tokenize.Location = New System.Drawing.Point(8, 80)
    Me.Tokenize.TabIndex = 2
    Me.Tokenize.BackColor = System.Drawing.SystemColors.Control
    Me.Tokenize.CausesValidation = True
    Me.Tokenize.Enabled = True
    Me.Tokenize.Cursor = System.Windows.Forms.Cursors.Default
    Me.Tokenize.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.Tokenize.TabStop = True
    Me.Tokenize.Name = "Tokenize"
    Me.txString.AutoSize = False
    Me.txString.Size = New System.Drawing.Size(289, 27)
    Me.txString.Location = New System.Drawing.Point(8, 40)
    Me.txString.TabIndex = 1
    Me.txString.Text = " "
    Me.txString.AcceptsReturn = True
    Me.txString.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
    Me.txString.BackColor = System.Drawing.SystemColors.Window
    Me.txString.CausesValidation = True
    Me.txString.Enabled = True
    Me.txString.ForeColor = System.Drawing.SystemColors.WindowText
    Me.txString.HideSelection = True
    Me.txString.ReadOnly = False
    Me.txString.MaxLength = 0
    Me.txString.Cursor = System.Windows.Forms.Cursors.IBeam
    Me.txString.Multiline = False
    Me.txString.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.txString.ScrollBars = System.Windows.Forms.ScrollBars.None
    Me.txString.TabStop = True
    Me.txString.Visible = True
    Me.txString.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
    Me.txString.Name = "txString"
    Me.Label1.Text = "Enter string to tokenize"
    Me.Label1.Size = New System.Drawing.Size(129, 17)
    Me.Label1.Location = New System.Drawing.Point(16, 8)
    Me.Label1.TabIndex = 0
    Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopLeft
    Me.Label1.BackColor = System.Drawing.SystemColors.Control
    Me.Label1.Enabled = True
    Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
    Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
    Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.Label1.UseMnemonic = True
    Me.Label1.Visible = True
    Me.Label1.AutoSize = False
    Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
    Me.Label1.Name = "Label1"
    Me.Controls.Add(lsTokens)
    Me.Controls.Add(Tokenize)
    Me.Controls.Add(txString)
    Me.Controls.Add(Label1)
  End Sub
#End Region
#Region "Upgrade Support "
  Private Shared m_vb6FormDefInstance As Tokenshow
  Private Shared m_InitializingDefInstance As Boolean
  Public Shared Property DefInstance() As Tokenshow
    Get
      If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
        m_InitializingDefInstance = True
        m_vb6FormDefInstance = New Tokenshow()
        m_InitializingDefInstance = False
      End If
      DefInstance = m_vb6FormDefInstance
    End Get
    Set(ByVal Value As Tokenshow)
      m_vb6FormDefInstance = Value
    End Set
  End Property
#End Region

  Private Sub Tokenize_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Tokenize.Click
    Dim tok As StringTokenizer = New StringTokenizer(txString.Text)
    Dim s As String

    lsTokens.Items.Clear()        'wyczyść listę
    s = tok.nextToken             'pobierz token
    While Len(s) > 0              'wykonuj aż token pusty
      lsTokens.Items.Add(s)       'dodaj do listy
      s = tok.nextToken           'pobierz następny token
    End While
  End Sub

End Class