Transfering data from one Windows form to another.

  • Thread starter Thread starter MuCanceri10
  • Start date Start date
M

MuCanceri10

Guest
Hello, I am a Novice Programmer.

I have a problem, of getting data from one form to another. Let me explain.

In Windows Form1, I have Input Boxes for decimal numbers for me to input and these are link to be added and divided to form a total, to give a average. The problem is, I would like to output the result onto a second form, either resided on a label or a textbox in Form2. Now, I do not have a problem with having an output result on form1 by providing it with a label or a textbox on that form, but not with the second form. the only connection with the second form at the moment is a 'Next' button Me. hide() and Form2.Show().

This is the program listing on Windows Form1:

Dim intFormPtsTotal As Integer = 0
Dim decFastBreakTotal As Decimal = 0, decGradedTimeTotal As Decimal = 0, decWinGradedTimeTotal As Decimal = 0

intFormPtsTotal = Val(TextBox2.Text) + (TextBox3.Text) + (TextBox4.Text) + (TextBox5.Text) + (TextBox6.Text)

decFastBreakTotal = (Val(TextBox7.Text) + (TextBox8.Text) + (TextBox9.Text) + (TextBox10.Text) + (TextBox11.Text)) / 5

decGradedTimeTotal = (Val(TextBox12.Text) + (TextBox13.Text) + (TextBox14.Text) + (TextBox15.Text) + (TextBox16.Text)) / 5

decWinGradedTimeTotal = (Val(TextBox17.Text) + (TextBox18.Text) + (TextBox19.Text) + (TextBox20.Text) + (TextBox21.Text)) / 5

The above, is to work out the average.

And this is what I put on Windows Form2:

Me.Label11.Text = Form2.intFormPtsTotal.Text
Me.Label12.Text = Form2.decFastBreakTotal.Text
Me.Label13.Text = Form2.decGradedTimeTotal.Text
Me.Label14.Text = Form2.decWinGradedTimeTotal.Text

The outcome of this, was no response when I run the program. Any suggestions will be appreaciated. thank you.

Continue reading...
 
Back
Top