Hi, im doing an assignment for my college course using VB.
The situation is this....
On Form1 i have 2 variables which are changed by different actions on the same form. In this case the 2 variables are Order Count and Running Total. The idea is that with the other functions, I create an order on Form1 and when i hit "summary" It brings up Form2 which calls on the 2 variables from Form1 to show me the number of orders and the running total.
The commands i used are Form2.Show() on click of "Summary" and then me.hide() from inside of Form2 to close it.
However, the way it is, i can only use the Form2 once, if i call it again, it still shows me the previous information. I have a "reset" button on Form2 also which works fine for setting the values to 0 but then it still doesnt update.
Just to clarify, now ive explained some background....
If i create 3 orders on Form1 with a total of $250 and then hit summary, it loads Form2 which says 3 orders and $250 total, if i then hide Form2 and create another 2 orders bringing my total to $270 and click summary, it still says 3 orders and $250. If use reset in Form2 to set values to 0 manually, then enter more orders, Summary still says 0
Is there something wrong with the way im calling Form2 by using show/hide that its not running through its script every time its shown? I tried using me.close() when i leave the summary form but then im unable to reopen it. Is there a load command I could use from Form1 so it forces an update?
If this helps.......
-----------------------------------------------------------------------------
Form1 Extract:
Private Sub buttSumm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttSumm.Click
Form2.Show()
End Sub
---------------------------------------------------------------------------------
Form2:
Public Class Form2
Public Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label4.Text = Form1.RunTotal
Label3.Text = Form1.OrderCount
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Hide()
End Sub
End Class
Thanks Greg, spot on!!
Got no best answer button though!
Cheers
The situation is this....
On Form1 i have 2 variables which are changed by different actions on the same form. In this case the 2 variables are Order Count and Running Total. The idea is that with the other functions, I create an order on Form1 and when i hit "summary" It brings up Form2 which calls on the 2 variables from Form1 to show me the number of orders and the running total.
The commands i used are Form2.Show() on click of "Summary" and then me.hide() from inside of Form2 to close it.
However, the way it is, i can only use the Form2 once, if i call it again, it still shows me the previous information. I have a "reset" button on Form2 also which works fine for setting the values to 0 but then it still doesnt update.
Just to clarify, now ive explained some background....
If i create 3 orders on Form1 with a total of $250 and then hit summary, it loads Form2 which says 3 orders and $250 total, if i then hide Form2 and create another 2 orders bringing my total to $270 and click summary, it still says 3 orders and $250. If use reset in Form2 to set values to 0 manually, then enter more orders, Summary still says 0
Is there something wrong with the way im calling Form2 by using show/hide that its not running through its script every time its shown? I tried using me.close() when i leave the summary form but then im unable to reopen it. Is there a load command I could use from Form1 so it forces an update?
If this helps.......
-----------------------------------------------------------------------------
Form1 Extract:
Private Sub buttSumm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttSumm.Click
Form2.Show()
End Sub
---------------------------------------------------------------------------------
Form2:
Public Class Form2
Public Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label4.Text = Form1.RunTotal
Label3.Text = Form1.OrderCount
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Hide()
End Sub
End Class
Thanks Greg, spot on!!
Got no best answer button though!
Cheers