1 Replies - 443 Views - Last Post: 21 August 2013 - 04:09 AM Rate Topic: -----

#1 JimmyB  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 16-August 13

Changing Label Text depending on boolean

Posted 21 August 2013 - 02:45 AM

Hi am trying to change labels depending on a boolean. The boolean would determine if you play a mage, warrior or archer. The label11.text then changes to what the user inputted as the specified class. The sample code for a warrior is below. It in hindsight; should change the two labels to what the class (vb warrior class) stats are. It simply does nothing. Please bare with me; I am new to coding.

Private Sub Shop_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MainMenu.Close()
        Dim Warrior As Warrior
        Warrior = New Warrior
        

        If Label11.Text = "Class:   WARRIOR" Then
            Label8.Text = Warrior.Health
            Label9.Text = Warrior.Attack
        End If

       
    End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: Changing Label Text depending on boolean

#2 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 966
  • Joined: 09-May 09

Re: Changing Label Text depending on boolean

Posted 21 August 2013 - 04:09 AM

Wheres the boolean :P/>

ok first off, inside yout Warrior Class you have get and set properties for Warrior.health and attack?

Why are you creating an object of warrior and trying to set the label to its value, has a value been set??

Label11.Text = "Class:   WARRIOR"



How is the above being set, please remember that
"Class: WARRIOR"
"Class: WARRIOR" <- auto format in DIC, its supposed to show less white spaces

are not the same

Put a breakpoint at the code stated above, when the compiler hits this press f10 and let it know where the next line of code is executed

This post has been edited by deery5000: 21 August 2013 - 04:38 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1