title: having a subroutine wait for button input before ending the sub
body: <p>I am using a do while loop that after every loop, needs to ask the user what he/she wants to do next. The program is a pokemon style battle rpg, except for letting pokemon fight, you fight the monsters yourself. </p>
  
  <p>What I am looking for is a pokemon/final fantasy style of fighting.</p>
  
  <p>this is my sub that handles the battles:</p>
  
  <pre><code>  Private Sub Battle(ByVal Name As String, ByVal life As Integer, ByVal damage As Integer)
  
      lbl_MonsterName.Text = Name
      mobCurrHealth = mobMaxHealth
      lbl_MonsterHP.Text = mobCurrHealth &amp; " / " &amp; mobMaxHealth
      bar_monsterHP.Value = mobCurrHealth
      bar_monsterHP.Maximum = mobMaxHealth
  
  
      txtbx_Action.AppendText(Environment.NewLine &amp; "You find a " &amp; Name)
      lbl_MonsterName.Visible = True
      lbl_MonsterHP.Visible = True
      bar_monsterHP.Visible = True
  
      wait(2000)
  
      txtbx_Action.AppendText(Environment.NewLine &amp; "What would you like to do?")
      btn_Attack.Visible = True
      btn_Run.Visible = True
  
  'Here I want the program to wait for button input, but i still have to find a way to do that        
  
  
  End Sub
  </code></pre>
  
  <p>After the line " What would you like to do", 2 (3) buttons will be visible: </p>
  
  <ul>
  <li>Attack</li>
  <li>Run</li>
  <li>(Inventory)</li>
  </ul>
  
  <p>However, as you can see (and I do understand what is wrong, I just don't know how to fix it) my battle sub ends after the buttons are made visible.</p>
  
  <p>I want the sub to wait until I have pressed either of these buttons are pressed and then act accordingly.</p>
  
  <p>How can I do this?</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>This is the code I use, where the sub "Battle"  is called:</p>
  
  <pre><code>   Private Sub btn_Adventure_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Adventure.Click
  
      btn_Adventure.Visible = False
  
      txtbx_Action.Visible = True
  
      Dim rng As New Random
      Dim MobGen As Integer = rng.Next(1, 4)
  
      Select Case MobGen
  
          Case 1
              mobName = "Rat"
              mobMaxHealth = 5
              mobDamage = 2
          Case 2
              mobName = "Bat"
              mobMaxHealth = 7
              mobDamage = 3
          Case 3
              mobName = "Snake"
              mobMaxHealth = 9
              mobDamage = 4
          Case 4
              mobName = "Wolf"
              mobMaxHealth = 11
              mobDamage = 5
  
      End Select
  
      txtbx_Action.AppendText(Environment.NewLine &amp; "You run around the forest trying to find something to kill")
      wait(1500)
      Battle(mobName, mobMaxHealth, mobDamage)
  
  
      btn_Adventure.Visible = True
  
  End Sub
  </code></pre>
  
  <p>Also, if you think the way I am handling the program now is very wrong, please let me know how to improve it! This is a hobby project to try to learn the vb.net language a bit better, so any advice or constructive critisism  is verry appreciated!</p>