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

VB - Building Object Name with Variable Datas


  • Please log in to reply

#1
ChrisWright

ChrisWright

    Member

  • Member
  • PipPip
  • 34 posts
Hello,

Quick Intro (Skip to get to the problem)
Having recentely started with VB 6.0, I've been trying to experiment as much as possible.

Through a number of tutorials I have managed to produce functional app's, although they wouldn't help people out much :whistling: ...

The Problem

I want to use a variable to build part of an object name, so it selects an object to increase the value of in a progressive order, triggered by 'Timer'.


Rough Idea:
(I have declarations, but for now i shall omitt)

On Timer
If OBJECT(VARIABLE).Value Is 100 Then VARIABLE = VARIABLE + 1
Else OBJECT(VARIABLE).Value = OBJECT(VARIABLE).Value + 5

Update:
I believe that I i probably haven't explained very well...
I am trying to experiment with progress bars, and am trying to simplify some code I have made.

The code I am trying to streamline is the follow:

Private Sub Form_Load()
Full = ""
End Sub

Private Sub Timer1_Timer()
Select Case Pb1.Value
	Case Is < 100
		Pb1.Value = Pb1.Value + 1
	Case 100
		Select Case Pb2.Value
			Case Is < 100
				Pb2.Value = Pb2.Value + 1
			Case 100
				Select Case Pb3.Value
					Case Is < 100
						Pb3.Value = Pb3.Value + 1
					Case 100
						Timer1.Interval = 0
				End Select
		End Select
End Select
End Sub


I hope this update helps...
End Update



Context:


In my code I have a variable declared (integer), which i shall call 'Number'

I wish to execute code that uses 'Number' to build part of the name of an object

The form currentely contains 3 Progress bars, usefully named 'Pg1', 'Pg2', 'Pg3' and a timer, named 'Timer'


I wish for on timer, +10 to be added to the first Pg bar, until Pg1 = 100 (using conditional statement) is full, at which 'Number' will increase one



Basically - I wish to know how to make it so it will use 'Number' to fill in the appropriate number in the name, that it will automatically move from 'Pg1', to 'Pg2', to 'Pg3'.



If you are able to decypher that all, well done...
Even better, Can you help ?
Thanks if you have read this far,
Chris

Edited by ChrisWright, 04 August 2006 - 06:04 AM.

  • 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