Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

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!




I need help with vb 2005 code

 
Reply to this topicStart new topic

I need help with vb 2005 code

jbeannie
3 Oct, 2007 - 01:21 PM
Post #1

New D.I.C Head
*

Joined: 3 Oct, 2007
Posts: 16


My Contributions
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

        m_strPlayers(0) = "Amy"
        m_strPlayers(1) = "Brendan"
        m_strPlayers(2) = "Brian"
        m_strPlayers(3) = "Charlie"
        m_strPlayers(4) = "Celia"
        m_strPlayers(5) = "David"
        m_strPlayers(6) = "Eric"
        m_strPlayers(7) = "Evelyn"
        m_strPlayers(8) = "Harriet"
        m_strPlayers(9) = "Arnold"
        m_strPlayers(10) = "Betty"
        m_strPlayers(11) = "Carla"
        m_strPlayers(12) = "Daniel"
        m_strPlayers(13) = "Eleanor"
        m_strPlayers(14) = "Frank"
        m_strPlayers(15) = "George"
        m_strPlayers(16) = "Mary"
        m_strPlayers(17) = "Veronica"

        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())

            m_intPlayer += 1
        End If

    End Sub
End Class

User is offlineProfile CardPM
+Quote Post

Martyr2
RE: I Need Help With Vb 2005 Code
3 Oct, 2007 - 01:46 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,199



Thanked: 213 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
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.

Thanks! smile.gif
User is offlineProfile CardPM
+Quote Post

jbeannie
RE: I Need Help With Vb 2005 Code
3 Oct, 2007 - 02:14 PM
Post #3

New D.I.C Head
*

Joined: 3 Oct, 2007
Posts: 16


My Contributions
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

        m_strPlayers(0) = "Amy"
        m_strPlayers(1) = "Brendan"
        m_strPlayers(2) = "Brian"
        m_strPlayers(3) = "Charlie"
        m_strPlayers(4) = "Celia"
        m_strPlayers(5) = "David"
        m_strPlayers(6) = "Eric"
        m_strPlayers(7) = "Evelyn"
        m_strPlayers(8) = "Harriet"
        m_strPlayers(9) = "Arnold"
        m_strPlayers(10) = "Betty"
        m_strPlayers(11) = "Carla"
        m_strPlayers(12) = "Daniel"
        m_strPlayers(13) = "Eleanor"
        m_strPlayers(14) = "Frank"
        m_strPlayers(15) = "George"
        m_strPlayers(16) = "Mary"
        m_strPlayers(17) = "Veronica"

        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())

            m_intPlayer = +1
            m_intIndex += 1
        End If

    End Sub
End Class



User is offlineProfile CardPM
+Quote Post

Martyr2
RE: I Need Help With Vb 2005 Code
3 Oct, 2007 - 03:05 PM
Post #4

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,199



Thanked: 213 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
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. smile.gif
User is offlineProfile CardPM
+Quote Post

jbeannie
RE: I Need Help With Vb 2005 Code
3 Oct, 2007 - 04:07 PM
Post #5

New D.I.C Head
*

Joined: 3 Oct, 2007
Posts: 16


My Contributions
QUOTE(Martyr2 @ 3 Oct, 2007 - 04:05 PM) *

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. smile.gif


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
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: I Need Help With Vb 2005 Code
3 Oct, 2007 - 05:12 PM
Post #6

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
This is a VB.Net topic so I'm moving it to that forum smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 01:14AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month