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
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