| | |
How to find Max????
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2009
Posts: 44
Reputation:
Solved Threads: 4
OK, you didn't say how you got those values, so I just added them to an arraylist during form_load event. My code is a little backwards, but it works for me, lol.
The max and min values are backwards for me, but it works, sometimes, lol. See if that helps any. It's not perfect but should help you out some.
VB.NET Syntax (Toggle Plain Text)
Dim dblArray As New ArrayList() dblArray.Add("-223.5") dblArray.Add("-78.9") dblArray.Add("-999.7") dblArray.Add("-456.7") Dim holdMin As String = "" Dim holdMax As String = "" 'get max & min For i = 0 To dblArray.Count - 1 For i2 = 1 To dblArray.Count - 1 If dblArray.Item(i) > dblArray.Item(i2) Then If dblArray.Item(i) > holdMax Then holdMax = dblArray.Item(i) holdMin = dblArray.Item(i2) Else holdMax = dblArray.Item(i2) holdMin = holdMin End If ElseIf dblArray.Item(i) < dblArray.Item(i2) Then If dblArray.Item(i) < holdMin Then holdMin = dblArray.Item(i) holdMax = dblArray.Item(i2) Else holdMin = dblArray.Item(i2) holdMax = holdMax End If End If Next Next 'this is the minimum value for some reason :P TextBox2.Text = holdMax 'this is the maximum value for some reason :P TextBox3.Text = holdMin
The max and min values are backwards for me, but it works, sometimes, lol. See if that helps any. It's not perfect but should help you out some.
Last edited by crazyhorse09; Mar 18th, 2009 at 6:41 pm.
![]() |
Similar Threads
- Max Of 3 Numbers With Out Comaparison Ops? (C++)
- How to find the maximum value in each column of 2D? (C++)
- How can i find out the Max and Min value from a Vector? (C++)
Other Threads in the VB.NET Forum
- Previous Thread: how to encrypthing and decrything an xml file in vb.thanks
- Next Thread: linking database Microsoft Access with VB.NET
| Thread Tools | Search this Thread |
.net .net2008 30minutes 2005 2008 access account arithmetic array basic bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google gridview hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





