Dim energybar As New Rectangle(9, 154, energy, 21)
That is my new rectangle, now when I draw it
e.Graphics.FillRectangle(Brushes.Blue, energybar)
It says there is no width but the integer energy is = to 100…
now, how do I fix this? It but be somewhat simple…
Your code works. I put it in a Form_Paint event which resulted in the Image below. I would strongly suspect that your energy variable’s value is the problem. Make sure that if the variable is not declared in the
Paintmethod that you make it aClassScoped variable: