Problemino nel codice sottostante io faccio la media del valore di 31 textbox inserendo il risultato nella textbox188. e fin li nessun problema.
il fatto e che io vorrei che il risultato deve avere solo un numero dopo la virgola. e non riesco
con due textbox e semplice ma con 31?
ecco il codice
Codice:
Private Sub sommamedia()
Try
Dim ahyp As Integer = Integer.Parse(TextBox4.Text)
Me.TextBox188.Text = (ahyp)
Dim bhyp As Integer = Integer.Parse(TextBox10.Text)
Me.TextBox188.Text = (ahyp + bhyp) / 2
Dim chyp As Integer = Integer.Parse(TextBox16.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp) / 3
Dim dhyp As String = Integer.Parse(TextBox22.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp) / 4
Dim eehyp As String = Integer.Parse(TextBox28.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp) / 5
Dim fhyp As String = Integer.Parse(TextBox34.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp) / 6
Dim ghyp As String = Integer.Parse(TextBox40.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp) / 7
Dim hhyp As String = Integer.Parse(TextBox46.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp) / 8
Dim ihyp As String = Integer.Parse(TextBox52.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp) / 9
Dim lhyp As String = Integer.Parse(TextBox58.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp) / 10
Dim mhyp As String = Integer.Parse(TextBox64.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp) / 11
Dim nhyp As String = Integer.Parse(TextBox70.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp) / 12
Dim ohyp As String = Integer.Parse(TextBox76.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp) / 13
Dim phyp As String = Integer.Parse(TextBox82.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp) / 14
Dim qhyp As String = Integer.Parse(TextBox88.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp) / 15
Dim rhyp As String = Integer.Parse(TextBox94.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp) / 16
Dim shyp As String = Integer.Parse(TextBox100.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp) / 17
Dim thyp As String = Integer.Parse(TextBox106.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp) / 18
Dim uhyp As String = Integer.Parse(TextBox112.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp) / 19
Dim vhyp As String = Integer.Parse(TextBox118.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp) / 20
Dim zhyp As String = Integer.Parse(TextBox124.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp) / 21
Dim khyp As String = Integer.Parse(TextBox130.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp) / 22
Dim xhyp As String = Integer.Parse(TextBox136.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp) / 23
Dim jhyp As String = Integer.Parse(TextBox142.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp + jhyp) / 24
Dim aahyp As String = Integer.Parse(TextBox148.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp + jhyp + aahyp) / 25
Dim abhyp As String = Integer.Parse(TextBox154.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp + jhyp + aahyp + abhyp) / 26
Dim achyp As String = Integer.Parse(TextBox160.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp + jhyp + aahyp + abhyp + achyp) / 27
Dim adhyp As String = Integer.Parse(TextBox166.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp + jhyp + aahyp + abhyp + achyp + adhyp) / 28
Dim aehyp As String = Integer.Parse(TextBox172.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp + jhyp + aahyp + abhyp + achyp + adhyp + aehyp) / 29
Dim afhyp As String = Integer.Parse(TextBox178.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp + jhyp + aahyp + abhyp + achyp + adhyp + aehyp + afhyp) / 30
Dim aghyp As String = Integer.Parse(TextBox184.Text)
Me.TextBox188.Text = (ahyp + bhyp + chyp + dhyp + eehyp + fhyp + ghyp + hhyp + ihyp + lhyp + mhyp + nhyp + ohyp + phyp + qhyp + rhyp + shyp + thyp + uhyp + vhyp + zhyp + khyp + xhyp + jhyp + aahyp + abhyp + achyp + adhyp + aehyp + afhyp + aghyp) / 31
Catch
End Try
End Sub
come devo fare?