Start New Discussion within our Software Development Community

Hey guys, i am kindof stuck on this one. i have a code that works fine....however i need to use an object class form and i dont know how to do that. here is my code:

Public Class CookieApp

    Dim TotalsInteger(5) As Integer

    Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
        Dim IndexInt As Integer
        Dim AmountInt As Integer

        IndexInt = Integer.Parse(GroupComboBox.SelectedItem.ToString)
        AmountInt = Integer.Parse(AmountTextBox.Text)

        TotalsInteger(IndexInt) += AmountInt
    End Sub

    Private Sub TotalsButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalsButton.Click
        ResultListBox.Items.Clear()
        For Each OneTotalInteger As Integer In TotalsInteger
            ResultListBox.Items.Add(OneTotalInteger)
        Next
    End Sub

    Private Sub MaxButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MaxButton.Click
        Dim Max As Integer = 0

        For Each OneTotalInteger As Integer In TotalsInteger
            If OneTotalInteger > Max Then
                Max = OneTotalInteger
            End If
        Next

        MaxTextBox.Text = Max.ToString
    End Sub

End Class

how would i go about turning this into a project that uses a seperate class and calls upon it? not asking you to do it all for me but i have no idea where to start with this.

Create a new Class Library project.
Then add a reference to System.Windows.Forms.
Now you're free to add and design windows forms to that project.
Compile.

In your current project, add a reference to the newly compiled Class Library binary (dll) and you can call methods and show forms as usual.

This article has been dead for over six months. Start a new discussion instead.