Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

VB6-Using String to give object name


  • Please log in to reply

#1
ChrisWright

ChrisWright

    Member

  • 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...
Thanks,
Chris
  • 0

Advertisements







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