Problem two forms

The_Bunny

Member
Joined
Jul 29, 2008
Messages
5
Programming Experience
Beginner
Ok, I am making a simple calculator that will do basic calculations, show the times tables of a specific number (that has been input into textbox1) in a listbox in a new form, will display all answers previously found in a new form (in a listbox) and will save all the answer previously found.

the times tables of a specific number and all answers previously found will be in different forms

I am having a problem with the coding though:

  1. i can't seem to get my head around the coding for sending data to a new form and putting it in a listbox (showing the times tables)

    I know that it comprises this coding to find the times tables but do not know how to send this to a lsitbox in a new form:

    VB.NET:
    Dim number, answer As Integer
            ListBox1.Items.Add("Value          Product")
    
            For number = 1 To 100
                answer = number * Val(TextBox1.Text)
                ListBox1.Items.Add(number & "          " & answer)
            Next number
    
            ListBox1.Items.Add("          ") 'print a blank line
            ListBox1.Items.Add(" End of Program ")

    All of this data needs to be sent to Form3 from Form1 by Button7 being pressed


  • Basically it is the same trouble for sending all previous answers that have been found to a listbox in another form, but i don't know how to compile all the answers i have found in the calculator so far either...I'm thinking the use of an Array might work but i'm not sure

    This will work by Button8 from Form1 being pressed and Form2 openign to display all the answers

  • Finally I need to save the data from Form2 (the data from the previous problem with my calculator, "Showing all Previous answers") in a notebook .txt file, this will be done by pressing Button2 which is on Form2




A lot of this may seem really confusing, it is even to me :p
I hope someone can help
 
Ok I have figured out my first problem (the tiems table one):

VB.NET:
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Dim number, answer As Integer

        Form3.ListBox1.Text = Form3.ListBox1.Items.Add("Value          Product")

        For number = 1 To 100
            answer = number * Val(TextBox1.Text)
            Form3.ListBox1.Items.Add(number & "          " & answer)
        Next number

        Form3.ListBox1.Items.Add("                    ") 'print a blank line

        Form3.Show()

Now i jsut need to figure out the other two problems...and they kind of rely on each other to work :p


Edit: OK, so with this second problem, I am trying to make an array/record type structure, as what normally happens an answer is found in the calculator and then displayed in Textbox3 on Form1, I want to then press Button8 and the answer should then be displayed in Listbox1 in Form2, if the user has not clicked this button before it will display every answer that has previously been found plus the answer that the user jsut typed in and if the user has clciked the button before the current answer it will not double-up the answers on a second click

Hope that helps a bit :p

Oh and then on Form2 a button2 will be in use to save all of the data in the listbox to a .txt file (notepad)

thanks
 
Last edited:
Trouble with Forms

I am having a problem with sending data from one form to another, I am trying to make an array/record type structure, as what normally happens an answer is found in the calculator and then displayed in Textbox3 on Form1, I want to then press Button8 and the answer should then be displayed in Listbox1 in Form2, if the user has not clicked this button before it will display every answer that has previously been found plus the answer that the user jsut typed in and if the user has clciked the button before the current answer it will not double-up the answers on a second click

Hope that helps a bit :p

Oh and then on Form2 a button2 will be in use to save all of the data in the listbox to a .txt file (notepad)

I have no idea how to do any of this, can it even be done in VB Code?

thanks
 
Back
Top