Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Counting points

Counting points

Scheduled Pinned Locked Moved Visual Basic
game-devhelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oliver_twistor
    wrote on last edited by
    #1

    Hi! I have a problem with my program. It is a small game, in which the two players (user and computer) receive one point when winning. First to three points will win the whole game. The problem is that after the players recieve their first point, and win again, they don't recieve any more points. What's the problem? Dim V_DuVin As Boolean Dim V_DatVin As Boolean Dim V_DinPoang As Integer Dim V_DatPoang As Integer If V_DuVin = True Then V_DinPoang = V_DinPoang + 1 Else If V_DatVin = True Then V_DatPoang = V_DatPoang + 1 End If //OT

    D P 2 Replies Last reply
    0
    • O oliver_twistor

      Hi! I have a problem with my program. It is a small game, in which the two players (user and computer) receive one point when winning. First to three points will win the whole game. The problem is that after the players recieve their first point, and win again, they don't recieve any more points. What's the problem? Dim V_DuVin As Boolean Dim V_DatVin As Boolean Dim V_DinPoang As Integer Dim V_DatPoang As Integer If V_DuVin = True Then V_DinPoang = V_DinPoang + 1 Else If V_DatVin = True Then V_DatPoang = V_DatPoang + 1 End If //OT

      D Offline
      D Offline
      dynamic
      wrote on last edited by
      #2

      VB:


      Dim V_DuVin As Boolean
      Dim V_DatVin As Boolean
      Dim V_DinPoang As Integer
      Dim V_DatPoang As Integer
      '////BELOW WINDOWS GENERATED CODE AREA^^^^.
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
          V_DuVin = True
      End Sub

      Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      If V_DuVin = True Then
          V_DinPoang = V_DinPoang + 1
          ElseIf V_DatVin = True Then
           V_DatPoang = V_DatPoang + 1
          End If
          MessageBox.Show(V_DinPoang)
      End Sub


      you must have the items dimmed on a main part of the form , like just below the windows generated code , otherwise the values will reset each time if they are only declared in a sub.:)


      Private void ExpectingTwins(string twins)
      {
      switch(twins)
      {
      Case ("twins on the way"):
      MessageBox.Show("for mr and mrs dynamic","twins on the way");
      break;
      }
      }


      O 1 Reply Last reply
      0
      • O oliver_twistor

        Hi! I have a problem with my program. It is a small game, in which the two players (user and computer) receive one point when winning. First to three points will win the whole game. The problem is that after the players recieve their first point, and win again, they don't recieve any more points. What's the problem? Dim V_DuVin As Boolean Dim V_DatVin As Boolean Dim V_DinPoang As Integer Dim V_DatPoang As Integer If V_DuVin = True Then V_DinPoang = V_DinPoang + 1 Else If V_DatVin = True Then V_DatPoang = V_DatPoang + 1 End If //OT

        P Offline
        P Offline
        parths
        wrote on last edited by
        #3

        Dim V_DinPoang As Integer Dim V_DatPoang As Integer Check the scope of these variables. Make them Global or Static "It was when I found out I could make mistakes that I knew I was on to something." -Ornette Coleman

        1 Reply Last reply
        0
        • D dynamic

          VB:


          Dim V_DuVin As Boolean
          Dim V_DatVin As Boolean
          Dim V_DinPoang As Integer
          Dim V_DatPoang As Integer
          '////BELOW WINDOWS GENERATED CODE AREA^^^^.
          Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
              V_DuVin = True
          End Sub

          Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
          If V_DuVin = True Then
              V_DinPoang = V_DinPoang + 1
              ElseIf V_DatVin = True Then
               V_DatPoang = V_DatPoang + 1
              End If
              MessageBox.Show(V_DinPoang)
          End Sub


          you must have the items dimmed on a main part of the form , like just below the windows generated code , otherwise the values will reset each time if they are only declared in a sub.:)


          Private void ExpectingTwins(string twins)
          {
          switch(twins)
          {
          Case ("twins on the way"):
          MessageBox.Show("for mr and mrs dynamic","twins on the way");
          break;
          }
          }


          O Offline
          O Offline
          oliver_twistor
          wrote on last edited by
          #4

          Thanks. The problems are solved. //OT

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups