|
-
Mar 12th, 2000, 07:20 AM
#1
Thread Starter
New Member
I am sort of a vb newbie.. There are many little things which I haven't taken the time to research and experiment with yet.. I am curious about UBound - what is it, why would i ever need to type "UBound" in any way shape or form and what kind of program could i make to learn how to use it (i learn by doing )
- any help would be appreciated.. Thanks..
Code:
Private Sub cmdExit_Click()
msgbox "I THINK NOT!",vbokonly,"i b a hax0r"
end sub
-
Mar 12th, 2000, 07:48 AM
#2
Member
Look up info on arrays. Thats where you're going to use UBound. You will most likely use it along with LBound. It means, simply, Upper Bound(LBound -- Lower Bound). The upper bound is the highest element of the array. The lower bound is, of course, the lowest element. If you had a array of...lets say command buttons which you wanted to have disappear, then you could do it easily in 3 lines of code(using a for loop) for no matter how many buttons you have. It would look like this:
for i = Command1.LBound to Command1.Ubound
Command1(i).visible = False
next i
What that code does is start with the first command button in the array(command1(0)) because 0 is the lowest number in the array and sets it's visible property to false. then, i increases(by one--default step of a for loop) allowing command1(1) to be set to false, and so on. This will finish when the upperbound has been reached. At that point, all of the command buttons will be invisible.
I hope this has helped you understand UBound. You might want to, like i said, look up arrays and while you're at it, for loops because they will be used often times in for loops.
Have fun with vb. its great!
GreenDey
-
Mar 15th, 2000, 04:13 AM
#3
Thread Starter
New Member
Re: UBound
Thanks a lot.. I got it now, i understand arrays so i understood nicely. Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|