Join 136,186 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,075 people online right now. Registration is fast and FREE... Join Now!
Private m_arrlstTeams As ArrayList Private m_strPlayers(17) As String Private m_queuePlayers As New Queue Private m_stackPlayers As New Stack Private m_intPlayer As Integer Private m_intIndex As Integer
Private Sub frmBaseballLeague_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Array.Sort(m_strPlayers) btnReset.PerformClick() End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnReset.Click For Each ctl As Control In Me.Controls If TypeOf (ctl) Is ListBox Then CType(ctl, ListBox).Items.Clear() End If Next m_queuePlayers.Clear() m_stackPlayers.Clear() For intIndex As Integer = 0 To m_strPlayers.Length - 1 lstPlayers.Items.Add(m_strPlayers(intIndex)) m_queuePlayers.Enqueue(m_strPlayers(intIndex)) m_stackPlayers.Push(m_strPlayers(intIndex)) Next lstPlayers.SelectedIndex = -1 End Sub
Private Sub btnQueue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQueue.Click
If m_intIndex Mod 2 = 0 Then lstYankees.Items.Add(m_queuePlayers.Dequeue()) Else lstDodgers.Items.Add(m_queuePlayers.Dequeue()) End If
If lstPlayers.Items.Count <> 0 Then lstPlayers.Items.Remove(m_queuePlayers.Peek.ToString())
m_intPlayer += 1 End If
End Sub
Private Sub btnStack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStack.Click
If m_intIndex Mod 2 = 0 Then lstYankees.Items.Add(m_queuePlayers.Dequeue()) Else lstDodgers.Items.Add(m_queuePlayers.Dequeue()) End If
If lstPlayers.Items.Count <> 0 Then lstPlayers.Items.Remove(m_stackPlayers.Peek.ToString())
I am sure we can help, what is your question and or problem? Also, please put your code in code tags when posting here. It makes things a bit easier for us helpers in looking through.
I have new code, I think it works pretty code, not sure if it could be better though
CODE
Public Class frmBaseballLeague
Private m_arrlstTeams As ArrayList Private m_strPlayers(17) As String Private m_queuePlayers As New Queue Private m_stackPlayers As New Stack Private m_intPlayer As Integer Private m_intIndex As Integer
Private Sub frmBaseballLeague_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Array.Sort(m_strPlayers) btnReset.PerformClick() End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnReset.Click For Each ctl As Control In Me.Controls If TypeOf (ctl) Is ListBox Then CType(ctl, ListBox).Items.Clear() End If Next m_queuePlayers.Clear() m_stackPlayers.Clear() For intIndex As Integer = 0 To m_strPlayers.Length - 1 lstPlayers.Items.Add(m_strPlayers(intIndex)) m_queuePlayers.Enqueue(m_strPlayers(intIndex)) m_stackPlayers.Push(m_strPlayers(intIndex)) Next lstPlayers.SelectedIndex = -1 End Sub
Private Sub btnQueue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQueue.Click
If m_intIndex Mod 2 = 0 Then lstYankees.Items.Add(m_queuePlayers.Dequeue()) Else lstDodgers.Items.Add(m_queuePlayers.Dequeue()) End If
If lstPlayers.Items.Count <> 0 Then lstPlayers.Items.Remove(m_queuePlayers.Peek.ToString())
m_intPlayer += 1 m_intIndex += 1 End If
End Sub
Private Sub btnStack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStack.Click
If m_intIndex Mod 2 = 0 Then lstYankees.Items.Add(m_queuePlayers.Dequeue()) Else lstDodgers.Items.Add(m_queuePlayers.Dequeue()) End If
If lstPlayers.Items.Count <> 0 Then lstPlayers.Items.Remove(m_stackPlayers.Peek.ToString())
Well I am sure it is pweeeety code but I think we are all still waiting for what the problem / question related to this absolutely fabulous and outstandingly pretty code might be.
Well I am sure it is pweeeety code but I think we are all still waiting for what the problem / question related to this absolutely fabulous and outstandingly pretty code might be.
I thought you guy's might know how to improve, like make up stuff up, to make it better, because it
does work, I don't know how well structured it is.
This post has been edited by jbeannie: 3 Oct, 2007 - 04:07 PM