max number

harry5568

Member
Hello everybody,
In a program I'm trying to make,I have on my Form, data in text-boxes,in 2 columns, as follows:
290 15
300 10
310 20
320 12

How do I find the max of numbers in the second column(in this case 20),and further,how do I make it indicate 310,which corresponds to this max number in the same row in first column?? Thanx fr yr replies...Harry
 

ExcludeReality

Active Member
Licensed User
I can barely believe it myself, but I was able to make an example.
Hope it helps
 

Attachments

  • Example.sbp
    1.6 KB · Views: 181

harry5568

Member
I can barely believe it myself, but I was able to make an example.
Hope it helps

Thanks....Can anybody further tell me how to sort a list of numbers and letters in an arraylist , so as to show the largest of numbers in Index(0).
For eg, if we have a 2 3 9 d g in the arraylist,
how to sort it as 9 3 2 a d g

arrayList1.sort(cNumber)
arrayList1.Reverse

is not working,it leaves an error.Thanx..Harry
 

klaus

Expert
Licensed User
Longtime User
Are you shure that you want as the result 9 3 2 a d g ?
This will not be easy to do because the numbers are in descending order and the letters are in ascending order ?

You say that your program doesn't work, that you get an error.
To be able to help you should also what error you get, or better post your source code.
How did you fill the ArrayList ?
You have numbers and letters, so you can't sort by numbers as 'a', 'd' and 'g' are not numbers.
In B4PPC all variables are string variables. For calculations, B4PPC changes internally the strings into numbers.

Attached a small test program with your example:
With ArrayList1.Sort(cCaseUnsensitive)

And following resutls
Sort: 2 3 9 a d g
Reverse: g d a 9 3 2

Best regards.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…