Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

VB6-Using String to give object name

  • Please log in to reply




  • Member
  • PipPip
  • 34 posts
I am trying to create a short piece of code, so that when a pre-existing object reaches a certain size it adds 1 to a variable, which is used to give the name of the next pre-existing object.

What i want:

(Form has a number of progress bars - Named ProgressBar1 to ProgressBar(Maximum) )

On Timer
If ("ProgressBar" & Number & ".Value") = 100 Then

   Select Case Number

	  Case Maximum
		 Timer1.Interval = 0

	  Case <Maximum
		 Number = Number + 1

   End Select

Else ("ProgressBar" & Number & ".Value") = ("ProgressBar" & Number & ".Value") + 10

So far the only code i have is to experiment, where i have made a form with a label and 1 button, which should seem pretty straight forward:

Option Explicit

Dim Number As Integer

Private Sub Command1_Click()
Number = Number + 1
Label1.Caption = "Default" & Number & ".Value"
End Sub

Private Sub Form_Load()
Number = 1
Label1.Caption = "Default" & Number & ".Value"
End Sub

Can Anyone help fix up my coding ? I am rather a beginner...
  • 0


Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP