Q:

VB NET, cumulative damage

I am new to coding and trying stuff out. I'm hoping someone could help. I have a code for a health bar that indicates attacks and heals. However I want to create a textbox that will indicate the health in a number format. I have no idea how to approach the problem. The txtHP.text is where I want the number to appear.Here is my code so far:
Public Class Form1
    Dim bteNombre As Integer
    Public DMap As New Bitmap(Me.Width, Me.Height, Me.CreateGraphics)
    Public GraphicsBuffer As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(DMap)
    Public HpBarG As Integer = 100
    Public HpBarR As Integer = 100

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles MyBase.Load
        DrawHpBar()
    End Sub
    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As  _
                            System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        e.Graphics.DrawImage(DMap, 0, 0)
    End Sub
    Private Sub DrawHpBar()
If HpBarG < 0 Then
    HpBarG = 0
End If
If HpBarG > 100 Then
    HpBarG = 100
End If
        GraphicsBuffer.DrawRectangle(Pens.Black, New Rectangle(47 - 1, 5 - 1, 100 + 1, 15))
        GraphicsBuffer.FillRectangle(Brushes.Red, New Rectangle(47, 5, HpBarR, 14))
        GraphicsBuffer.FillRectangle(Brushes.Lime, New Rectangle(47, 5, HpBarG, 14))
        Me.Invalidate(New Rectangle(47 - 1, 5 - 1, 100 + 1, 15))

    End Sub

    Private Sub btnAttack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
                Handles btnAttack.Click
        Randomize()
        bteNombre = Int((10 - 1 + 1) * Rnd() + 1)
        txtAtkHeal.Text = bteNombre.ToString
        HpBarG -= txtAtkHeal.Text
        DrawHpBar()

    End Sub

    Private Sub btnHeal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
               Handles btnHeal.Click
        Randomize()
        bteNombre = Int((5 - 1 + 1) * Rnd() + 1)
        txtAtkHeal.Text = bteNombre.ToString
        HpBarG += txtAtkHeal.Text
        DrawHpBar()
        txtHP.Text = bteNombre

    End Sub

End Class 

Thanks!

A:

Create a text box and then assign the Text property, like this:
TextBox1.Text = HpBarG.ToString()

If you want to show the value as a percentage, then do this:
TextBox1.Text = HpBarG.ToString("P")

For more information about the different ways to format a number as a string, read Standard Numeric Format Strings.

