# How to display month beside the minimum and maximum values

Page 1 of 1

## 1 Replies - 951 Views - Last Post: 22 January 2014 - 07:31 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=338738&amp;s=53c13e8e386f10d2d734febcdd712578&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 akif13

Reputation: 0
• Posts: 3
• Joined: 07-December 12

# How to display month beside the minimum and maximum values

Posted 22 January 2014 - 04:44 PM

How can I display month(i) beside the minimum or maximum values. Let's say minimum was 12 and it was month January. I want it to be display beside the value of min or max. Is there any other way I can close the form when user clicked cancel and exit in InputBox? I don't know how to do it if rainfall(11) as "integer"
```        Dim Month = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
Dim rainfall(11) As Integer
Dim i_max, i_min As Integer

For i = 0 To 11

' Input rainfall for each month, require non-negative numbers,
rainfall(i) = CInt(InputBox("Please enter the rainfall for " & Month(i), "Challenge 2 - Rainfall Statistics"))
' and display input on the form for the user to see

lstInput.Items.Add(rainfall(i) & " for " & Month(i))
total = total + rainfall(i)
avg = total / 12

Next

i_min = LBound(rainfall)
i_max = UBound(rainfall)

max = rainfall(i_min)
min = rainfall(i_min)
For i = i_min + 1 To i_max
If rainfall(i) > max Then
max = rainfall(i)
ElseIf rainfall(i) < min Then
min = rainfall(i)
End If
dispmin = "The minimum monthly rainfall was (" & min & ")" & Month(i)
dispmax = "The maximum monthly rainfall was(" & max & ")" & Month(i)
Next

' If the user clicks the Cancel button or enters an
' empty string, leave this Click handler immediately.
' Exit if the user clicks the Cancel button
'initialize variables to first month's (January's) rainfall
'look at rest of monthly rainfall data and update stats
'calculate results and display them - note that if more than one
'month tied for the max or min, only the first month is named as
'the max or min on the output.

```

Is This A Good Question/Topic? 0

## Replies To: How to display month beside the minimum and maximum values

### #2 astonecipher

Reputation: 1715
• Posts: 7,074
• Joined: 03-December 12

## Re: How to display month beside the minimum and maximum values

Posted 22 January 2014 - 07:31 PM

Your question(s) are not that clear. Are you receiving errors, first?

Are you asking to close the form if the user clicks the cancel button on the input where they are entering the rainfall data?

If so, use dialogResult to retrieve the button pressed.

Where are you trying to display the information together and what are you trying to display?

Month Inches
January 11

something like that in your listbox?