Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show highest number

Status
Not open for further replies.

clientuser

Programmer
Apr 18, 2001
296
US
I have a form that calculates totals, there are six people listed on the form that has a total for each person..

what i would like to see is whoever has the highest number, show that number in a label somewhere else on the form..

question is, how do i get that highest number?
 
How are you storeing the numbers? Rob
"Programming is like art...It makes me feel like chopping my ear off."
 
I do not need to store them at this time so for now they are in textboxes..

 
Your best bet is to store them right off the bat, they can always be reinitialized ;) I'm going to let you know, I'm no expert, but here's how I personally would do it.

dim names(1 to 10) as string
dim values(1 to 10) as string
dim highest as long
highest = 0

' initialize all your names/values eg...
' names(1) = "Bob"
' values(1) = 99
' There may be a way to have both integer
' and string values in an array, but I don't
' know of it ;P

for I = 1 to ubound(values)
if values(I) > highest then
highest = values(I)
J = I
end if
next

txtBox.text = names(J) & "-" & values(J)

----------
Hope this helps
Rob Rob
"Programming is like art...It makes me feel like chopping my ear off."
 
did it help? I like to know these things ;) Rob
"Programming is like art...It makes me feel like chopping my ear off."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top