Advertisement

01.15.2008 at 04:20AM PST, ID: 23083589
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Is there a way to simplify this code?

Asked by touyets in VB Script

Tags: ,

Hi,

I have a form with 14 numericupdowns (labelled 1 to 14) and they are arrange din 2 collums of 7 numericupdowns and a labelle is at the end of every row and colum and I have created a code that makes it recalculate every end of colum and row if one of the numeric up downs is clicked. Also, the 2columms numericupdowns have a maximum set to the value of the numericupdown in the first colum and on the same row as them.

Here is the layout of the form (text version):

NUP1 | NUP8 | Label23
NUP2 | NUP9 | Label24
NUP3 | NUP10 | Label25
NUP4 | NUP11 | Label26
NUP5 | NUP12 | Label27
NUP6 | NUP13 | Label28
NUP7 | NUP14 | Label29
Label20 | Label21

Is there a way to simplify the code attached?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
Public Class Form1
  
    Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown8.Maximum = NumericUpDown1.Value
        If NumericUpDown1.Value = 0 Then
            Label23.Text = 0 & "%"
        Else : Label23.Text = Int((NumericUpDown8.Value / NumericUpDown1.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown2.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown9.Maximum = NumericUpDown2.Value
        If NumericUpDown2.Value = 0 Then
            Label24.Text = 0 & "%"
        Else : Label24.Text = Int((NumericUpDown9.Value / NumericUpDown2.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown3_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown3.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown10.Maximum = NumericUpDown3.Value
        If NumericUpDown3.Value = 0 Then
            Label25.Text = 0 & "%"
        Else : Label25.Text = Int((NumericUpDown10.Value / NumericUpDown3.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown4_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown4.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown11.Maximum = NumericUpDown4.Value
        If NumericUpDown4.Value = 0 Then
            Label26.Text = 0 & "%"
        Else : Label26.Text = Int((NumericUpDown11.Value / NumericUpDown4.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown5_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown5.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown12.Maximum = NumericUpDown5.Value
        If NumericUpDown5.Value = 0 Then
            Label27.Text = 0 & "%"
        Else : Label27.Text = Int((NumericUpDown12.Value / NumericUpDown5.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown6_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown6.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown13.Maximum = NumericUpDown6.Value
        If NumericUpDown6.Value = 0 Then
            Label28.Text = 0 & "%"
        Else : Label28.Text = Int((NumericUpDown13.Value / NumericUpDown6.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown7_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown7.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown14.Maximum = NumericUpDown7.Value
        If NumericUpDown7.Value = 0 Then
            Label29.Text = 0 & "%"
        Else : Label29.Text = Int((NumericUpDown14.Value / NumericUpDown7.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown8_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown8.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown8.Maximum = NumericUpDown1.Value
        If NumericUpDown1.Value = 0 Then
            Label23.Text = 0 & "%"
        Else : Label23.Text = Int((NumericUpDown8.Value / NumericUpDown1.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown9_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown9.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown9.Maximum = NumericUpDown2.Value
        If NumericUpDown2.Value = 0 Then
            Label24.Text = 0 & "%"
        Else : Label24.Text = Int((NumericUpDown9.Value / NumericUpDown2.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown10_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown10.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown10.Maximum = NumericUpDown3.Value
        If NumericUpDown3.Value = 0 Then
            Label25.Text = 0 & "%"
        Else : Label25.Text = Int((NumericUpDown10.Value / NumericUpDown3.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown11_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown11.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown11.Maximum = NumericUpDown4.Value
        If NumericUpDown4.Value = 0 Then
            Label26.Text = 0 & "%"
        Else : Label26.Text = Int((NumericUpDown11.Value / NumericUpDown4.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown12_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown12.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown12.Maximum = NumericUpDown5.Value
        If NumericUpDown5.Value = 0 Then
            Label27.Text = 0 & "%"
        Else : Label27.Text = Int((NumericUpDown12.Value / NumericUpDown5.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown13_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown13.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown13.Maximum = NumericUpDown6.Value
        If NumericUpDown6.Value = 0 Then
            Label28.Text = 0 & "%"
        Else : Label28.Text = Int((NumericUpDown13.Value / NumericUpDown6.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
 
    Private Sub NumericUpDown14_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown14.ValueChanged
        CheckBox1.Checked = False
        NumericUpDown14.Maximum = NumericUpDown7.Value
        If NumericUpDown7.Value = 0 Then
            Label29.Text = 0 & "%"
        Else : Label29.Text = Int((NumericUpDown14.Value / NumericUpDown7.Value) * 100) & "%"
        End If
        Label20.Text = NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value
        Label21.Text = NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value
        If (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) = 0 Then
            Label40.Text = 0 & "%"
        Else : Label40.Text = Int((NumericUpDown8.Value + NumericUpDown9.Value + NumericUpDown10.Value + NumericUpDown11.Value + NumericUpDown12.Value + NumericUpDown13.Value + NumericUpDown14.Value) / (NumericUpDown1.Value + NumericUpDown2.Value + NumericUpDown3.Value + NumericUpDown4.Value + NumericUpDown5.Value + NumericUpDown6.Value + NumericUpDown7.Value) * 100) & "%"
        End If
    End Sub
End Class
 
Loading Advertisement...
 
[+][-]01.15.2008 at 05:09AM PST, ID: 20662152

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: VB Script
Tags: Visual Basic, Visual basic 2008 Express Edition
Sign Up Now!
Solution Provided By: TimCottee
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628