hi pls help me i have error to my code in shortest job next

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim cc As Integer
        Dim tt As Integer
        Dim wt As Integer
        Dim ryan As Integer = TextBox1.Text

        For escal As Integer = 1 To ryan
            cc = InputBox("Enter no. of CC")
            ListBox1.Items.Add(cc)
            tt = cc + tt
            ListBox2.Items.Add(tt)

            

        Next



    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim ara As List(Of Integer) = New List(Of Integer)


        For Each S As String In ListBox1.Items
            ara.Add(CInt(S))
           
        Next
        ListBox1.Items.Clear()
        ara.Sort()
        For Each I As Integer In ara
            ListBox1.Items.Add(I)
        Next

and then then the output:
cc tt
10 10
8 18
5 23
2 25

if i sort the cc
cc tt
2 10 <-------ERROR =(
5 18
8 23
10 25


my error is my computational pls help me

You must use the same structure than in the button1 on button 2 to fill also the ListBox2

ListBox1.Items.Clear()
        ListBox2.Items.Clear()
        tt = 0
        ara.Sort()
        For Each I As Integer In ara
            ListBox1.Items.Add(I)
            tt += I
            ListBox2.Items.Add(tt)
        Next

Hope this helps

help me because i have an error to my computational to get the sum on listbox this is my code


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cc As Integer
Dim tt As Integer
Dim wt As Integer
Dim finish As Integer = TextBox1.Text
Dim tempttave As Double
Dim ttaverage As Double

For start As Integer = 1 To finish
cc = InputBox("Enter No. of CC")
ListBox1.Items.Add(cc)
tt = tt + cc
ListBox2.Items.Add(tt)
wt = tt - cc
ListBox3.Items.Add(wt)

tempttave = tt + tt
TextBox2.Text = tempttave


Next

then the output to get the sum on listbox2

2
5
9
14
total 28 <=====Wrong instead 30 pls help me sir=(

Maybe you need to change

tempttave = tt + tt

by

tempttave = tempttave + tt

Hope this helps

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.