Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7890971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:29:45+00:00 2026-06-03T06:29:45+00:00

Dim energybar As New Rectangle(9, 154, energy, 21) That is my new rectangle, now

  • 0
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…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:29:47+00:00Added an answer on June 3, 2026 at 6:29 am

    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 Paint method that you make it a Class Scoped variable:

    Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim energy As Integer = 100
        Dim energybar As New Rectangle(9, 154, energy, 21)
    
        e.Graphics.FillRectangle(Brushes.Blue, energybar)
    
    End Sub
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dim objMail As New Mail.MailMessage(no-reply@mywebsite.com, ToEmail, Password Reset, body) ...and the problem is that
Dim x = GetType(List(Of )) 'valid statement Dim list As New List(Of String) Now
Dim ItemList As New ArrayList() For i = 0 To dgExtract.Items.Count - 1 gRow
Dim de As New System.DirectoryServices.DirectoryEntry() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
Dim db As New SQLDataContext Try Dim deleteBoatPics = (From boat In db.Photos Where
Dim usersInRole As String() = Roles.GetUsersInRole(HR_Base_Role) Dim Myusers As New MembershipUserCollection For Each UserName
Dim arr As New Collection, a Dim aFirstArray() As Variant ...some code For Each
Dim customers As List(Of Customer) = New List(Of Customer) For Each mbi In fordContracts
dim dt as new datatable dt.columns.Add(Check, Type.GetType(System.Boolean)) datagridview1.datasource = dt A boolean type datacolumn
Dim myDelims As String() = New String() {<beginning of record>} Dim split1 As String()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.