I have timer in my code and every 10 second one result appear I need to make GUI and when I push the Button I want to have every time the result. I tried to use Button but it only shows me the final result. Please help me

Private Sub Button1_Click(ByVal sender As System.Object, 
            ByVal e As System.EventArgs) Handles Button1.Click 
      While powervalue >= 10 
           powerDecrease() 
           TextBox3.Text = CType(Me.powervalue, String) & "V" 
      End While 
End Sub

It is showing you all of the results. It's just that all of the intermediate results are appearing so fast you don't get a chance to see them. I'm assuming powervalue is declared at the class level. In that case you could set up a timer with an interval of 10000 (10 seconds) and do the following

Private Sub tmrMyTimer_Tick(sender As Object, e As EventArgs) Handles tmrMyTimer.Tick

    If powervalue >= 10 Then
        PowerDecrease()
        TextBox3.Text = CType(Me.powervalue, String) & "V" 
    Else
        tmrMyTimer.Stop
    End If

End Sub     

Then in the button code you could do

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

    powervalue = <some initial value>
    tmrMyTimer.Start

End Sub

Thank you for repling. Actually my code is so big I just need way to show result in every time the value change. I mean in each entry to loop. Can i do this in GUI

Then I don't see the problem. When you calculate the new value just copy it to the textbox or label to display it.

when I push Button it only shows me the final result and I can not put a timer in Button1_Click.

I already showed you how to do that by using a timer that is activated by the button so you can effectively put a timer in a button click. One further option I could suggest is the following which is a really bad idea. I'll show you the code then tell you why it is bad.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
    While powervalue >= 10 
        powerDecrease() 
        TextBox3.Text = CType(Me.powervalue, String) & "V" 
        System.Threading.Thread.Sleep(1000)
    End While 
End Sub

This (effectiively) does the same thing as the timer solution. It pauses for one second after each recalculation. The reason this is a very (VERY) bad idea is because it causes your entire application to become unresponsive (the entire app goes to sleep for one second each time through the loop). Using a timer avoids this.

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.