I don't really know how to make the code for the following question.

I need a program that counts. The program will ask the user what he/she wants to count by and It will then count from 0 to 20 using what ever increment that user has chosen

I want to use a listbox to display all the numbers, and I want a textbox to enter what to count to 20 by. Also I have one button that will start the counting.

Thanks for any help with this

Hello Tasty,

I can give you a help. This is a simple program. Can you give me a GUI for your program? So I can give you a code for your GUI.

Thank You.

@tasty: Please post your code and specific questions about the parts you are having trouble with.

@saruba: The point of the forums is to help people fix their code by themselves - not write it for them.

commented: You right in a way, thanks. But some people ask questions without the knowledge of VB.NET. That's why I use that way. +1

Here is the code I have so far. I know its wrong but i can't seem to figure it out. Attached is the view of the form, and how I think it should be set up. Thanks for any help, I know this is should be an easy code.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        Dim j As Integer
        Do Until i = 20
        Loop
        j = 0
        For i = 0 To 20
            j = j + i
        Next i
        TextBox1.Text = j
        ListBox1.Text = i
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
End Class

Hello Tasty,

Here is the solution. Use a listbox(ListBox1), textbox(TextBox1) and a button(Button1).

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        ListBox1.Items.Clear()

        Dim j As Integer
        j = 0

        Do While j < 20
            j = j + TextBox1.Text
            If j <= 20 Then
                ListBox1.Items.Add(j)
            End If
        Loop

    End Sub
commented: How do you expect to learn if you just complete their assignments for them? -3

Check it
--------
Type a value in the textbox, then the program add the results to the listbox itself.


Is this the thing you looking for, Tasty?

reply.

Thanks

Check it
--------
Type a value in the textbox, then the program add the results to the listbox itself.


Is this the thing you looking for, Tasty?

reply.

Thanks

Thanks you, that is exactly what I needed.

Thanks again for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.