Ubound vs. Count
Ubound vs. Count
Ubound vs. Count
Ubound vs. Count
Ubound vs. Count
Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count
Ubound vs. Count Ubound vs. Count
Ubound vs. Count
Go Back  Xtreme Visual Basic Talk > > > Ubound vs. Count


Reply
 
Thread Tools Display Modes
  #1  
Old 04-18-2018, 03:14 PM
leezinho leezinho is offline
Regular
 
Join Date: Jun 2009
Posts: 67
Default Ubound vs. Count


In VB5, when I want to work with the size of an array of controls,
does it matter whether I use "arrayName.Count" or "arrayName.UBound"?
Reply With Quote
  #2  
Old 04-19-2018, 04:28 AM
Daigon Ali Daigon Ali is offline
Regular
 
Join Date: Aug 2014
Location: London
Posts: 73
Default

Hi,

Count is the number of physical controls
Ubound is the highest index.

So, if you had a control array of four command buttons indexed 0 to 3, Count would be 4 but Ubound would be 3.
However the indexes might not be sequential e.g. if you delete the middle two controls you'd have two buttons with indexes of 0,3 respectively, so the ubound would still be three.
In practice though, the array will usually be sequential starting at zero and any work other than returning the number of items would require an index, so Ubound is probably more useful.
Reply With Quote
  #3  
Old 04-19-2018, 07:07 AM
leezinho leezinho is offline
Regular
 
Join Date: Jun 2009
Posts: 67
Default Ubound vs. Count

Thanks. That's clear.
Reply With Quote
Reply

Tags
array, arrayname.count, arrayname.ubound, controls, matter, count, ubound


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Ubound vs. Count
Ubound vs. Count
Ubound vs. Count Ubound vs. Count
Ubound vs. Count
Ubound vs. Count
Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count Ubound vs. Count
Ubound vs. Count
Ubound vs. Count
 
Ubound vs. Count
Ubound vs. Count
 
-->