|
-
Nov 14th, 2012, 08:42 AM
#1
Thread Starter
Junior Member
can someone fix?
i've been working on a code but 1 button refuses to work?
can anyone figger out why button1 isn't working, and fix it?
Public Class form1
Dim num1 As Single ''integer / long
Dim num2 As Single ''integer / long
Dim num3 As Single ''integer / long
Dim num4 As Single ''integer / long
Dim num5 As Single ''integer / long
Dim num6 As Single ''integer / long
Dim num7 As Single ''integer / long
Dim num8 As Single ''integer / long
Dim num9 As Single ''integer / long
Dim num10 As Single ''integer / long
Dim num11 As Single ''integer / long
Dim num12 As Single ''integer / long
Dim num13 As Single ''integer / long
Dim num14 As Single ''integer / long
Dim num15 As Single ''integer / long
Dim num16 As Single ''integer / long
Dim num17 As Single ''integer / long
Dim num18 As Single ''integer / long
Dim num19 As Single ''integer / long
Dim num20 As Single ''integer / long
Dim num21 As Single ''integer / long
Dim num22 As Single ''integer / long
Dim num23 As Single ''integer / long
Dim num24 As Single ''integer / long
Dim num25 As Single ''integer / long
Dim num26 As Single ''integer / long
Dim num27 As Single ''integer / long
Dim num28 As Single ''integer / long
Dim num29 As Single ''integer / long
Dim num30 As Single ''integer / long
Dim num31 As Single ''integer / long
Dim num32 As Single ''integer / long
Dim num33 As Single ''integer / long
Dim num34 As Single ''integer / long
Dim num35 As Single ''integer / long
Dim num36 As Single ''integer / long
Dim num37 As Single ''integer / long
Dim num38 As Single ''integer / long
Dim num39 As Single ''integer / long
Dim num40 As Single ''integer / long
Dim num41 As Single ''integer / long
Dim num42 As Single ''integer / long
Dim num43 As Single ''integer / long
Dim num44 As Single ''integer / long
Dim num45 As Single ''integer / long
Dim num46 As Single ''integer / long
Dim num47 As Single ''integer / long
Dim num48 As Single ''integer / long
Dim num49 As Single ''integer / long
Dim num50 As Single ''integer / long
Dim num51 As Single ''integer / long
Dim num52 As Single ''integer / long
Dim num57 As Single ''integer / long
Dim num58 As Single '' integer / long
Dim num59 As Single ''integer / long
Dim num60 As Single '' integer / long
Dim num61 As Single ''integer / long
Dim num62 As Single '' integer / long
Dim num63 As Single ''integer / long
Dim num64 As Single '' integer / long
Dim num65 As Single ''integer / long
Dim num66 As Single '' integer / long
Dim num67 As Single ''integer / long
Dim num68 As Single '' integer / long
Dim num69 As Single ''integer / long
Dim num70 As Single '' integer / long
Dim num71 As Single ''integer / long
Dim num72 As Single '' integer / long
Dim num73 As Single ''integer / long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If TextBox17.Text <> "" Then
num1 = TextBox17.Text()
End If
If TextBox26.Text <> "" Then
num2 = TextBox26.Text()
End If
If TextBox25.Text <> "" Then
num3 = TextBox25.Text()
End If
If TextBox24.Text <> "" Then
num4 = TextBox24.Text()
End If
If TextBox23.Text <> "" Then
num5 = TextBox23.Text()
End If
If TextBox22.Text <> "" Then
num6 = TextBox22.Text()
End If
If TextBox21.Text <> "" Then
num7 = TextBox21.Text()
End If
If TextBox20.Text <> "" Then
num8 = TextBox20.Text()
End If
If TextBox19.Text <> "" Then
num9 = TextBox19.Text()
End If
If TextBox18.Text <> "" Then
num10 = TextBox18.Text()
End If
If TextBox27.Text <> "" Then
num11 = TextBox27.Text()
End If
If TextBox38.Text <> "" Then
num12 = TextBox38.Text()
End If
If TextBox29.Text <> "" Then
num13 = TextBox29.Text()
End If
If TextBox30.Text <> "" Then
num14 = TextBox30.Text()
End If
If TextBox31.Text <> "" Then
num15 = TextBox31.Text()
End If
If TextBox32.Text <> "" Then
num16 = TextBox32.Text()
End If
If TextBox33.Text <> "" Then
num17 = TextBox33.Text()
End If
If TextBox34.Text <> "" Then
num18 = TextBox34.Text()
End If
If TextBox35.Text <> "" Then
num19 = TextBox35.Text()
End If
If TextBox36.Text <> "" Then
num20 = TextBox36.Text()
End If
If TextBox37.Text <> "" Then
num21 = TextBox37.Text()
End If
If TextBox28.Text <> "" Then
num22 = TextBox28.Text()
End If
If TextBox45.Text <> "" Then
num23 = TextBox45.Text()
End If
If TextBox51.Text <> "" Then
num24 = TextBox51.Text()
End If
If TextBox46.Text <> "" Then
num25 = TextBox46.Text()
End If
If TextBox52.Text <> "" Then
num26 = TextBox52.Text()
End If
If TextBox47.Text <> "" Then
num27 = TextBox47.Text()
End If
If TextBox53.Text <> "" Then
num28 = TextBox53.Text()
End If
If TextBox48.Text <> "" Then
num29 = TextBox48.Text()
End If
If TextBox54.Text <> "" Then
num30 = TextBox54.Text()
End If
If TextBox49.Text <> "" Then
num31 = TextBox49.Text()
End If
If TextBox55.Text <> "" Then
num32 = TextBox55.Text()
End If
If TextBox50.Text <> "" Then
num33 = TextBox50.Text()
End If
If TextBox56.Text <> "" Then
num34 = TextBox56.Text()
End If
If Label19.Text <> "" Then
num35 = Label19.Text()
End If
If Label20.Text <> "" Then
num36 = Label20.Text()
End If
If Label21.Text <> "" Then
num37 = Label21.Text()
End If
If Label22.Text <> "" Then
num38 = Label22.Text()
End If
If Label23.Text <> "" Then
num39 = Label23.Text()
End If
If Label24.Text <> "" Then
num40 = Label24.Text()
End If
If Label25.Text <> "" Then
num41 = Label25.Text()
End If
If Label26.Text <> "" Then
num42 = Label26.Text()
End If
If Label27.Text <> "" Then
num43 = Label27.Text()
End If
If Label28.Text <> "" Then
num44 = Label28.Text()
End If
If Label29.Text <> "" Then
num45 = Label29.Text()
End If
If Label36.Text <> "" Then
num46 = Label36.Text()
End If
If Label37.Text <> "" Then
num47 = Label37.Text()
End If
If Label38.Text <> "" Then
num48 = Label38.Text()
End If
If Label39.Text <> "" Then
num49 = Label39.Text()
End If
If Label40.Text <> "" Then
num50 = Label40.Text()
End If
If Label41.Text <> "" Then
num51 = Label41.Text()
End If
If TextBox57.Text <> "" Then
num57 = TextBox57.Text()
End If
If TextBox58.Text <> "" Then
num58 = TextBox58.Text()
End If
If TextBox59.Text <> "" Then
num59 = TextBox59.Text()
End If
If TextBox60.Text <> "" Then
num60 = TextBox60.Text()
End If
If TextBox61.Text <> "" Then
num61 = TextBox61.Text()
End If
If TextBox62.Text <> "" Then
num62 = TextBox62.Text()
End If
If TextBox63.Text <> "" Then
num63 = TextBox63.Text()
End If
If TextBox64.Text <> "" Then
num64 = TextBox64.Text()
End If
If TextBox65.Text <> "" Then
num65 = TextBox65.Text()
End If
If TextBox66.Text <> "" Then
num66 = TextBox66.Text()
End If
If TextBox67.Text <> "" Then
num67 = TextBox67.Text()
End If
If TextBox68.Text <> "" Then
num68 = TextBox68.Text()
End If
If TextBox69.Text <> "" Then
num69 = TextBox69.Text()
End If
If TextBox70.Text <> "" Then
num70 = TextBox70.Text()
End If
If TextBox71.Text <> "" Then
num71 = TextBox71.Text()
End If
If TextBox72.Text <> "" Then
num72 = TextBox72.Text()
End If
If TextBox73.Text <> "" Then
num73 = TextBox73.Text()
End If
Catch
MsgBox(ErrorToString)
End Try
num35 = num1 * num12 - (0.01 * num57 * (num1 * num12))
num36 = num2 * num13 - (0.01 * num58 * (num2 * num13))
num37 = num3 * num14 - (0.01 * num59 * (num3 * num14))
num38 = num4 * num15 - (0.01 * num60 * (num4 * num15))
num39 = num5 * num16 - (0.01 * num61 * (num5 * num16))
num40 = num6 * num17 - (0.01 * num62 * (num6 * num17))
num41 = num7 * num18 - (0.01 * num63 * (num7 * num18))
num42 = num8 * num19 - (0.01 * num64 * (num8 * num12))
num43 = num9 * num20 - (0.01 * num65 * (num9 * num20))
num44 = num10 * num21 - (0.01 * num66 * (num10 * num21))
num45 = num11 * num22 - (0.01 * num67 * (num11 * num22))
num46 = num23 * num24 - (0.01 * num68 * (num23 * num24))
num47 = num25 * num26 - (0.01 * num69 * (num25 * num26))
num48 = num27 * num28 - (0.01 * num70 * (num27 * num28))
num49 = num29 * num30 - (0.01 * num71 * (num29 * num30))
num50 = num31 * num32 - (0.01 * num72 * (num31 * num32))
num51 = num33 * num34 - (0.01 * num73 * (num33 * num34))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox8.Clear()
TextBox9.Clear()
TextBox10.Clear()
TextBox11.Clear()
TextBox12.Clear()
TextBox13.Clear()
TextBox14.Clear()
TextBox15.Clear()
TextBox16.Clear()
TextBox17.Clear()
TextBox18.Clear()
TextBox19.Clear()
TextBox20.Clear()
TextBox21.Clear()
TextBox22.Clear()
TextBox23.Clear()
TextBox24.Clear()
TextBox25.Clear()
TextBox26.Clear()
TextBox27.Clear()
TextBox28.Clear()
TextBox29.Clear()
TextBox30.Clear()
TextBox31.Clear()
TextBox32.Clear()
TextBox33.Clear()
TextBox34.Clear()
TextBox35.Clear()
TextBox36.Clear()
TextBox37.Clear()
TextBox38.Clear()
TextBox45.Clear()
TextBox46.Clear()
TextBox47.Clear()
TextBox48.Clear()
TextBox49.Clear()
TextBox50.Clear()
TextBox51.Clear()
TextBox52.Clear()
TextBox53.Clear()
TextBox54.Clear()
TextBox55.Clear()
TextBox56.Clear()
TextBox57.Clear()
TextBox58.Clear()
TextBox59.Clear()
TextBox60.Clear()
TextBox61.Clear()
TextBox62.Clear()
TextBox63.Clear()
TextBox64.Clear()
TextBox65.Clear()
TextBox66.Clear()
TextBox67.Clear()
TextBox68.Clear()
TextBox69.Clear()
TextBox70.Clear()
TextBox71.Clear()
TextBox72.Clear()
TextBox73.Clear()
TextBox74.Clear()
TextBox75.Clear()
TextBox76.Clear()
TextBox77.Clear()
TextBox78.Clear()
TextBox79.Clear()
TextBox80.Clear()
TextBox81.Clear()
TextBox82.Clear()
TextBox83.Clear()
TextBox84.Clear()
TextBox85.Clear()
TextBox86.Clear()
TextBox87.Clear()
TextBox88.Clear()
TextBox89.Clear()
TextBox90.Clear()
-
Nov 14th, 2012, 08:55 AM
#2
Hyperactive Member
Re: can someone fix?
First of all, what is your error? Where does the error occur? Second, what are you trying to do? Your code seems bloated. Why are you using 73 variables? Maybe it would be better to use an array?
if i was able to help, rate my post!
-
Nov 14th, 2012, 08:57 AM
#3
Thread Starter
Junior Member
Re: can someone fix?
with button 1 i am trying to make calculations that i have posted in my post.
by the way, this is not the whole code
-
Nov 14th, 2012, 09:03 AM
#4
Hyperactive Member
Re: can someone fix?
What's the error? Where does it occur?
if i was able to help, rate my post!
-
Nov 14th, 2012, 09:09 AM
#5
Thread Starter
Junior Member
Re: can someone fix?
here is a code that works, but gives me the error. its a bit different but it should work.
i wil post a screenshot of the error.
Public Class form1
Dim num1 As Single ''integer / long
Dim num2 As Single ''integer / long
Dim num3 As Single ''integer / long
Dim num4 As Single ''integer / long
Dim num5 As Single ''integer / long
Dim num6 As Single ''integer / long
Dim num7 As Single ''integer / long
Dim num8 As Single ''integer / long
Dim num9 As Single ''integer / long
Dim num10 As Single ''integer / long
Dim num11 As Single ''integer / long
Dim num12 As Single ''integer / long
Dim num13 As Single ''integer / long
Dim num14 As Single ''integer / long
Dim num15 As Single ''integer / long
Dim num16 As Single ''integer / long
Dim num17 As Single ''integer / long
Dim num18 As Single ''integer / long
Dim num19 As Single ''integer / long
Dim num20 As Single ''integer / long
Dim num21 As Single ''integer / long
Dim num22 As Single ''integer / long
Dim num23 As Single ''integer / long
Dim num24 As Single ''integer / long
Dim num25 As Single ''integer / long
Dim num26 As Single ''integer / long
Dim num27 As Single ''integer / long
Dim num28 As Single ''integer / long
Dim num29 As Single ''integer / long
Dim num30 As Single ''integer / long
Dim num31 As Single ''integer / long
Dim num32 As Single ''integer / long
Dim num33 As Single ''integer / long
Dim num34 As Single ''integer / long
Dim num35 As Single ''integer / long
Dim num36 As Single ''integer / long
Dim num37 As Single ''integer / long
Dim num38 As Single ''integer / long
Dim num39 As Single ''integer / long
Dim num40 As Single ''integer / long
Dim num41 As Single ''integer / long
Dim num42 As Single ''integer / long
Dim num43 As Single ''integer / long
Dim num44 As Single ''integer / long
Dim num45 As Single ''integer / long
Dim num46 As Single ''integer / long
Dim num47 As Single ''integer / long
Dim num48 As Single ''integer / long
Dim num49 As Single ''integer / long
Dim num50 As Single ''integer / long
Dim num51 As Single ''integer / long
Dim num52 As Single ''integer / long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If TextBox17.Text <> "" Then
num1 = TextBox17.Text()
End If
If TextBox26.Text <> "" Then
num2 = TextBox26.Text()
End If
If TextBox25.Text <> "" Then
num3 = TextBox25.Text()
End If
If TextBox24.Text <> "" Then
num4 = TextBox24.Text()
End If
If TextBox23.Text <> "" Then
num5 = TextBox23.Text()
End If
If TextBox22.Text <> "" Then
num6 = TextBox22.Text()
End If
If TextBox21.Text <> "" Then
num7 = TextBox21.Text()
End If
If TextBox20.Text <> "" Then
num8 = TextBox20.Text()
End If
If TextBox19.Text <> "" Then
num9 = TextBox19.Text()
End If
If TextBox18.Text <> "" Then
num10 = TextBox18.Text()
End If
If TextBox27.Text <> "" Then
num11 = TextBox27.Text()
End If
If TextBox38.Text <> "" Then
num12 = TextBox38.Text()
End If
If TextBox29.Text <> "" Then
num13 = TextBox29.Text()
End If
If TextBox30.Text <> "" Then
num14 = TextBox30.Text()
End If
If TextBox31.Text <> "" Then
num15 = TextBox31.Text()
End If
If TextBox32.Text <> "" Then
num16 = TextBox32.Text()
End If
If TextBox33.Text <> "" Then
num17 = TextBox33.Text()
End If
If TextBox34.Text <> "" Then
num18 = TextBox34.Text()
End If
If TextBox35.Text <> "" Then
num19 = TextBox35.Text()
End If
If TextBox36.Text <> "" Then
num20 = TextBox36.Text()
End If
If TextBox37.Text <> "" Then
num21 = TextBox37.Text()
End If
If TextBox28.Text <> "" Then
num22 = TextBox28.Text()
End If
If TextBox45.Text <> "" Then
num23 = TextBox45.Text()
End If
If TextBox51.Text <> "" Then
num24 = TextBox51.Text()
End If
If TextBox46.Text <> "" Then
num25 = TextBox46.Text()
End If
If TextBox52.Text <> "" Then
num26 = TextBox52.Text()
End If
If TextBox47.Text <> "" Then
num27 = TextBox47.Text()
End If
If TextBox53.Text <> "" Then
num28 = TextBox53.Text()
End If
If TextBox48.Text <> "" Then
num29 = TextBox48.Text()
End If
If TextBox54.Text <> "" Then
num30 = TextBox54.Text()
End If
If TextBox49.Text <> "" Then
num31 = TextBox49.Text()
End If
If TextBox55.Text <> "" Then
num32 = TextBox55.Text()
End If
If TextBox50.Text <> "" Then
num33 = TextBox50.Text()
End If
If TextBox56.Text <> "" Then
num34 = TextBox56.Text()
End If
If Label19.Text <> "" Then
num35 = Label19.Text()
End If
If Label20.Text <> "" Then
num36 = Label20.Text()
End If
If Label21.Text <> "" Then
num37 = Label21.Text()
End If
If Label22.Text <> "" Then
num38 = Label22.Text()
End If
If Label23.Text <> "" Then
num39 = Label23.Text()
End If
If Label24.Text <> "" Then
num40 = Label24.Text()
End If
If Label25.Text <> "" Then
num41 = Label25.Text()
End If
If Label26.Text <> "" Then
num42 = Label26.Text()
End If
If Label27.Text <> "" Then
num43 = Label27.Text()
End If
If Label28.Text <> "" Then
num44 = Label28.Text()
End If
If Label29.Text <> "" Then
num45 = Label29.Text()
End If
If Label36.Text <> "" Then
num46 = Label36.Text()
End If
If Label37.Text <> "" Then
num47 = Label37.Text()
End If
If Label38.Text <> "" Then
num48 = Label38.Text()
End If
If Label39.Text <> "" Then
num49 = Label39.Text()
End If
If Label40.Text <> "" Then
num50 = Label40.Text()
End If
If Label41.Text <> "" Then
num51 = Label41.Text()
End If
Catch
MsgBox(ErrorToString)
End Try
num35 = num1 * num12 - (0.01 * TextBox57.Text * (num1 * num12))
num36 = num2 * num13 - (0.01 * TextBox58.Text * (num2 * num13))
num37 = num3 * num14 - (0.01 * TextBox59.Text * (num3 * num14))
num38 = num4 * num15 - (0.01 * TextBox60.Text * (num4 * num15))
num39 = num5 * num16 - (0.01 * TextBox61.Text * (num5 * num16))
num40 = num6 * num17 - (0.01 * TextBox62.Text * (num6 * num17))
num41 = num7 * num18 - (0.01 * TextBox63.Text * (num7 * num18))
num42 = num8 * num19 - (0.01 * TextBox64.Text * (num8 * num12))
num43 = num9 * num20 - (0.01 * TextBox65.Text * (num9 * num20))
num44 = num10 * num21 - (0.01 * TextBox66.Text * (num10 * num21))
num45 = num11 * num22 - (0.01 * TextBox67.Text * (num11 * num22))
num46 = num23 * num24 - (0.01 * TextBox68.Text * (num23 * num24))
num47 = num25 * num26 - (0.01 * TextBox69.Text * (num25 * num26))
num48 = num27 * num28 - (0.01 * TextBox70.Text * (num27 * num28))
num49 = num29 * num30 - (0.01 * TextBox71.Text * (num29 * num30))
num50 = num31 * num32 - (0.01 * TextBox72.Text * (num31 * num32))
num51 = num33 * num34 - (0.01 * TextBox73.Text * (num33 * num34))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox8.Clear()
TextBox9.Clear()
TextBox10.Clear()
TextBox11.Clear()
TextBox12.Clear()
TextBox13.Clear()
TextBox14.Clear()
TextBox15.Clear()
TextBox16.Clear()
TextBox17.Clear()
TextBox18.Clear()
TextBox19.Clear()
TextBox20.Clear()
TextBox21.Clear()
TextBox22.Clear()
TextBox23.Clear()
TextBox24.Clear()
TextBox25.Clear()
TextBox26.Clear()
TextBox27.Clear()
TextBox28.Clear()
TextBox29.Clear()
TextBox30.Clear()
TextBox31.Clear()
TextBox32.Clear()
TextBox33.Clear()
TextBox34.Clear()
TextBox35.Clear()
TextBox36.Clear()
TextBox37.Clear()
TextBox38.Clear()
TextBox45.Clear()
TextBox46.Clear()
TextBox47.Clear()
TextBox48.Clear()
TextBox49.Clear()
TextBox50.Clear()
TextBox51.Clear()
TextBox52.Clear()
TextBox53.Clear()
TextBox54.Clear()
TextBox55.Clear()
TextBox56.Clear()
TextBox57.Clear()
TextBox58.Clear()
TextBox59.Clear()
TextBox60.Clear()
TextBox61.Clear()
TextBox62.Clear()
TextBox63.Clear()
TextBox64.Clear()
TextBox65.Clear()
TextBox66.Clear()
TextBox67.Clear()
TextBox68.Clear()
TextBox69.Clear()
TextBox70.Clear()
TextBox71.Clear()
TextBox72.Clear()
TextBox73.Clear()
TextBox74.Clear()
TextBox75.Clear()
TextBox76.Clear()
TextBox77.Clear()
TextBox78.Clear()
TextBox79.Clear()
TextBox80.Clear()
TextBox81.Clear()
TextBox82.Clear()
TextBox83.Clear()
TextBox84.Clear()
TextBox85.Clear()
TextBox86.Clear()
TextBox87.Clear()
TextBox88.Clear()
TextBox89.Clear()
TextBox90.Clear()
-
Nov 14th, 2012, 09:10 AM
#6
Thread Starter
Junior Member
Re: can someone fix?
here is a code that works, but gives me the error. its a bit different but it should work.
i wil post a screenshot of the error.
Public Class form1
Dim num1 As Single ''integer / long
Dim num2 As Single ''integer / long
Dim num3 As Single ''integer / long
Dim num4 As Single ''integer / long
Dim num5 As Single ''integer / long
Dim num6 As Single ''integer / long
Dim num7 As Single ''integer / long
Dim num8 As Single ''integer / long
Dim num9 As Single ''integer / long
Dim num10 As Single ''integer / long
Dim num11 As Single ''integer / long
Dim num12 As Single ''integer / long
Dim num13 As Single ''integer / long
Dim num14 As Single ''integer / long
Dim num15 As Single ''integer / long
Dim num16 As Single ''integer / long
Dim num17 As Single ''integer / long
Dim num18 As Single ''integer / long
Dim num19 As Single ''integer / long
Dim num20 As Single ''integer / long
Dim num21 As Single ''integer / long
Dim num22 As Single ''integer / long
Dim num23 As Single ''integer / long
Dim num24 As Single ''integer / long
Dim num25 As Single ''integer / long
Dim num26 As Single ''integer / long
Dim num27 As Single ''integer / long
Dim num28 As Single ''integer / long
Dim num29 As Single ''integer / long
Dim num30 As Single ''integer / long
Dim num31 As Single ''integer / long
Dim num32 As Single ''integer / long
Dim num33 As Single ''integer / long
Dim num34 As Single ''integer / long
Dim num35 As Single ''integer / long
Dim num36 As Single ''integer / long
Dim num37 As Single ''integer / long
Dim num38 As Single ''integer / long
Dim num39 As Single ''integer / long
Dim num40 As Single ''integer / long
Dim num41 As Single ''integer / long
Dim num42 As Single ''integer / long
Dim num43 As Single ''integer / long
Dim num44 As Single ''integer / long
Dim num45 As Single ''integer / long
Dim num46 As Single ''integer / long
Dim num47 As Single ''integer / long
Dim num48 As Single ''integer / long
Dim num49 As Single ''integer / long
Dim num50 As Single ''integer / long
Dim num51 As Single ''integer / long
Dim num52 As Single ''integer / long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If TextBox17.Text <> "" Then
num1 = TextBox17.Text()
End If
If TextBox26.Text <> "" Then
num2 = TextBox26.Text()
End If
If TextBox25.Text <> "" Then
num3 = TextBox25.Text()
End If
If TextBox24.Text <> "" Then
num4 = TextBox24.Text()
End If
If TextBox23.Text <> "" Then
num5 = TextBox23.Text()
End If
If TextBox22.Text <> "" Then
num6 = TextBox22.Text()
End If
If TextBox21.Text <> "" Then
num7 = TextBox21.Text()
End If
If TextBox20.Text <> "" Then
num8 = TextBox20.Text()
End If
If TextBox19.Text <> "" Then
num9 = TextBox19.Text()
End If
If TextBox18.Text <> "" Then
num10 = TextBox18.Text()
End If
If TextBox27.Text <> "" Then
num11 = TextBox27.Text()
End If
If TextBox38.Text <> "" Then
num12 = TextBox38.Text()
End If
If TextBox29.Text <> "" Then
num13 = TextBox29.Text()
End If
If TextBox30.Text <> "" Then
num14 = TextBox30.Text()
End If
If TextBox31.Text <> "" Then
num15 = TextBox31.Text()
End If
If TextBox32.Text <> "" Then
num16 = TextBox32.Text()
End If
If TextBox33.Text <> "" Then
num17 = TextBox33.Text()
End If
If TextBox34.Text <> "" Then
num18 = TextBox34.Text()
End If
If TextBox35.Text <> "" Then
num19 = TextBox35.Text()
End If
If TextBox36.Text <> "" Then
num20 = TextBox36.Text()
End If
If TextBox37.Text <> "" Then
num21 = TextBox37.Text()
End If
If TextBox28.Text <> "" Then
num22 = TextBox28.Text()
End If
If TextBox45.Text <> "" Then
num23 = TextBox45.Text()
End If
If TextBox51.Text <> "" Then
num24 = TextBox51.Text()
End If
If TextBox46.Text <> "" Then
num25 = TextBox46.Text()
End If
If TextBox52.Text <> "" Then
num26 = TextBox52.Text()
End If
If TextBox47.Text <> "" Then
num27 = TextBox47.Text()
End If
If TextBox53.Text <> "" Then
num28 = TextBox53.Text()
End If
If TextBox48.Text <> "" Then
num29 = TextBox48.Text()
End If
If TextBox54.Text <> "" Then
num30 = TextBox54.Text()
End If
If TextBox49.Text <> "" Then
num31 = TextBox49.Text()
End If
If TextBox55.Text <> "" Then
num32 = TextBox55.Text()
End If
If TextBox50.Text <> "" Then
num33 = TextBox50.Text()
End If
If TextBox56.Text <> "" Then
num34 = TextBox56.Text()
End If
If Label19.Text <> "" Then
num35 = Label19.Text()
End If
If Label20.Text <> "" Then
num36 = Label20.Text()
End If
If Label21.Text <> "" Then
num37 = Label21.Text()
End If
If Label22.Text <> "" Then
num38 = Label22.Text()
End If
If Label23.Text <> "" Then
num39 = Label23.Text()
End If
If Label24.Text <> "" Then
num40 = Label24.Text()
End If
If Label25.Text <> "" Then
num41 = Label25.Text()
End If
If Label26.Text <> "" Then
num42 = Label26.Text()
End If
If Label27.Text <> "" Then
num43 = Label27.Text()
End If
If Label28.Text <> "" Then
num44 = Label28.Text()
End If
If Label29.Text <> "" Then
num45 = Label29.Text()
End If
If Label36.Text <> "" Then
num46 = Label36.Text()
End If
If Label37.Text <> "" Then
num47 = Label37.Text()
End If
If Label38.Text <> "" Then
num48 = Label38.Text()
End If
If Label39.Text <> "" Then
num49 = Label39.Text()
End If
If Label40.Text <> "" Then
num50 = Label40.Text()
End If
If Label41.Text <> "" Then
num51 = Label41.Text()
End If
Catch
MsgBox(ErrorToString)
End Try
num35 = num1 * num12 - (0.01 * TextBox57.Text * (num1 * num12))
num36 = num2 * num13 - (0.01 * TextBox58.Text * (num2 * num13))
num37 = num3 * num14 - (0.01 * TextBox59.Text * (num3 * num14))
num38 = num4 * num15 - (0.01 * TextBox60.Text * (num4 * num15))
num39 = num5 * num16 - (0.01 * TextBox61.Text * (num5 * num16))
num40 = num6 * num17 - (0.01 * TextBox62.Text * (num6 * num17))
num41 = num7 * num18 - (0.01 * TextBox63.Text * (num7 * num18))
num42 = num8 * num19 - (0.01 * TextBox64.Text * (num8 * num12))
num43 = num9 * num20 - (0.01 * TextBox65.Text * (num9 * num20))
num44 = num10 * num21 - (0.01 * TextBox66.Text * (num10 * num21))
num45 = num11 * num22 - (0.01 * TextBox67.Text * (num11 * num22))
num46 = num23 * num24 - (0.01 * TextBox68.Text * (num23 * num24))
num47 = num25 * num26 - (0.01 * TextBox69.Text * (num25 * num26))
num48 = num27 * num28 - (0.01 * TextBox70.Text * (num27 * num28))
num49 = num29 * num30 - (0.01 * TextBox71.Text * (num29 * num30))
num50 = num31 * num32 - (0.01 * TextBox72.Text * (num31 * num32))
num51 = num33 * num34 - (0.01 * TextBox73.Text * (num33 * num34))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox8.Clear()
TextBox9.Clear()
TextBox10.Clear()
TextBox11.Clear()
TextBox12.Clear()
TextBox13.Clear()
TextBox14.Clear()
TextBox15.Clear()
TextBox16.Clear()
TextBox17.Clear()
TextBox18.Clear()
TextBox19.Clear()
TextBox20.Clear()
TextBox21.Clear()
TextBox22.Clear()
TextBox23.Clear()
TextBox24.Clear()
TextBox25.Clear()
TextBox26.Clear()
TextBox27.Clear()
TextBox28.Clear()
TextBox29.Clear()
TextBox30.Clear()
TextBox31.Clear()
TextBox32.Clear()
TextBox33.Clear()
TextBox34.Clear()
TextBox35.Clear()
TextBox36.Clear()
TextBox37.Clear()
TextBox38.Clear()
TextBox45.Clear()
TextBox46.Clear()
TextBox47.Clear()
TextBox48.Clear()
TextBox49.Clear()
TextBox50.Clear()
TextBox51.Clear()
TextBox52.Clear()
TextBox53.Clear()
TextBox54.Clear()
TextBox55.Clear()
TextBox56.Clear()
TextBox57.Clear()
TextBox58.Clear()
TextBox59.Clear()
TextBox60.Clear()
TextBox61.Clear()
TextBox62.Clear()
TextBox63.Clear()
TextBox64.Clear()
TextBox65.Clear()
TextBox66.Clear()
TextBox67.Clear()
TextBox68.Clear()
TextBox69.Clear()
TextBox70.Clear()
TextBox71.Clear()
TextBox72.Clear()
TextBox73.Clear()
TextBox74.Clear()
TextBox75.Clear()
TextBox76.Clear()
TextBox77.Clear()
TextBox78.Clear()
TextBox79.Clear()
TextBox80.Clear()
TextBox81.Clear()
TextBox82.Clear()
TextBox83.Clear()
TextBox84.Clear()
TextBox85.Clear()
TextBox86.Clear()
TextBox87.Clear()
TextBox88.Clear()
TextBox89.Clear()
TextBox90.Clear()
-
Nov 14th, 2012, 09:23 AM
#7
Hyperactive Member
Re: can someone fix?
The error tells you what the problem is. You're trying to treat a string like a number. For example, what if the user entered "a" in the text box. How can you multiply 2*a? You can't. The same is with a blank field. Also, there is a difference between "1" and 1. One is a string, the other is a number. What you need to do is ensure all fields being used are filled in with only numbers (or has a default number). Then, cast the fields from string to a number. Ie:
Dim myNumber as integer
myNumber = cInt(textbox1.text)
if i was able to help, rate my post!
-
Nov 14th, 2012, 09:30 AM
#8
Thread Starter
Junior Member
Re: can someone fix?
oke ill try it
thank you
-
Nov 14th, 2012, 09:37 AM
#9
Thread Starter
Junior Member
Re: can someone fix?
ive tried this but i dont know how i should fix it.
can you fix it for me?:$
Public Class form1
Dim num1 As Single ''integer / long
Dim num2 As Single ''integer / long
Dim num3 As Single ''integer / long
Dim num4 As Single ''integer / long
Dim num5 As Single ''integer / long
Dim num6 As Single ''integer / long
Dim num7 As Single ''integer / long
Dim num8 As Single ''integer / long
Dim num9 As Single ''integer / long
Dim num10 As Single ''integer / long
Dim num11 As Single ''integer / long
Dim num12 As Single ''integer / long
Dim num13 As Single ''integer / long
Dim num14 As Single ''integer / long
Dim num15 As Single ''integer / long
Dim num16 As Single ''integer / long
Dim num17 As Single ''integer / long
Dim num18 As Single ''integer / long
Dim num19 As Single ''integer / long
Dim num20 As Single ''integer / long
Dim num21 As Single ''integer / long
Dim num22 As Single ''integer / long
Dim num23 As Single ''integer / long
Dim num24 As Single ''integer / long
Dim num25 As Single ''integer / long
Dim num26 As Single ''integer / long
Dim num27 As Single ''integer / long
Dim num28 As Single ''integer / long
Dim num29 As Single ''integer / long
Dim num30 As Single ''integer / long
Dim num31 As Single ''integer / long
Dim num32 As Single ''integer / long
Dim num33 As Single ''integer / long
Dim num34 As Single ''integer / long
Dim num35 As Single ''integer / long
Dim num36 As Single ''integer / long
Dim num37 As Single ''integer / long
Dim num38 As Single ''integer / long
Dim num39 As Single ''integer / long
Dim num40 As Single ''integer / long
Dim num41 As Single ''integer / long
Dim num42 As Single ''integer / long
Dim num43 As Single ''integer / long
Dim num44 As Single ''integer / long
Dim num45 As Single ''integer / long
Dim num46 As Single ''integer / long
Dim num47 As Single ''integer / long
Dim num48 As Single ''integer / long
Dim num49 As Single ''integer / long
Dim num50 As Single ''integer / long
Dim num51 As Single ''integer / long
Dim num52 As Single ''integer / long
Dim myNumber As Single '' integer / long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If TextBox17.Text <> "" Then
num1 = TextBox17.Text()
End If
If TextBox26.Text <> "" Then
num2 = TextBox26.Text()
End If
If TextBox25.Text <> "" Then
num3 = TextBox25.Text()
End If
If TextBox24.Text <> "" Then
num4 = TextBox24.Text()
End If
If TextBox23.Text <> "" Then
num5 = TextBox23.Text()
End If
If TextBox22.Text <> "" Then
num6 = TextBox22.Text()
End If
If TextBox21.Text <> "" Then
num7 = TextBox21.Text()
End If
If TextBox20.Text <> "" Then
num8 = TextBox20.Text()
End If
If TextBox19.Text <> "" Then
num9 = TextBox19.Text()
End If
If TextBox18.Text <> "" Then
num10 = TextBox18.Text()
End If
If TextBox27.Text <> "" Then
num11 = TextBox27.Text()
End If
If TextBox38.Text <> "" Then
num12 = TextBox38.Text()
End If
If TextBox29.Text <> "" Then
num13 = TextBox29.Text()
End If
If TextBox30.Text <> "" Then
num14 = TextBox30.Text()
End If
If TextBox31.Text <> "" Then
num15 = TextBox31.Text()
End If
If TextBox32.Text <> "" Then
num16 = TextBox32.Text()
End If
If TextBox33.Text <> "" Then
num17 = TextBox33.Text()
End If
If TextBox34.Text <> "" Then
num18 = TextBox34.Text()
End If
If TextBox35.Text <> "" Then
num19 = TextBox35.Text()
End If
If TextBox36.Text <> "" Then
num20 = TextBox36.Text()
End If
If TextBox37.Text <> "" Then
num21 = TextBox37.Text()
End If
If TextBox28.Text <> "" Then
num22 = TextBox28.Text()
End If
If TextBox45.Text <> "" Then
num23 = TextBox45.Text()
End If
If TextBox51.Text <> "" Then
num24 = TextBox51.Text()
End If
If TextBox46.Text <> "" Then
num25 = TextBox46.Text()
End If
If TextBox52.Text <> "" Then
num26 = TextBox52.Text()
End If
If TextBox47.Text <> "" Then
num27 = TextBox47.Text()
End If
If TextBox53.Text <> "" Then
num28 = TextBox53.Text()
End If
If TextBox48.Text <> "" Then
num29 = TextBox48.Text()
End If
If TextBox54.Text <> "" Then
num30 = TextBox54.Text()
End If
If TextBox49.Text <> "" Then
num31 = TextBox49.Text()
End If
If TextBox55.Text <> "" Then
num32 = TextBox55.Text()
End If
If TextBox50.Text <> "" Then
num33 = TextBox50.Text()
End If
If TextBox56.Text <> "" Then
num34 = TextBox56.Text()
End If
If Label19.Text <> "" Then
num35 = Label19.Text()
End If
If Label20.Text <> "" Then
num36 = Label20.Text()
End If
If Label21.Text <> "" Then
num37 = Label21.Text()
End If
If Label22.Text <> "" Then
num38 = Label22.Text()
End If
If Label23.Text <> "" Then
num39 = Label23.Text()
End If
If Label24.Text <> "" Then
num40 = Label24.Text()
End If
If Label25.Text <> "" Then
num41 = Label25.Text()
End If
If Label26.Text <> "" Then
num42 = Label26.Text()
End If
If Label27.Text <> "" Then
num43 = Label27.Text()
End If
If Label28.Text <> "" Then
num44 = Label28.Text()
End If
If Label29.Text <> "" Then
num45 = Label29.Text()
End If
If Label36.Text <> "" Then
num46 = Label36.Text()
End If
If Label37.Text <> "" Then
num47 = Label37.Text()
End If
If Label38.Text <> "" Then
num48 = Label38.Text()
End If
If Label39.Text <> "" Then
num49 = Label39.Text()
End If
If Label40.Text <> "" Then
num50 = Label40.Text()
End If
If Label41.Text <> "" Then
num51 = Label41.Text()
End If
myNumber = CInt(TextBox57.Text)
myNumber = CInt(TextBox58.Text)
myNumber = CInt(TextBox60.Text)
myNumber = CInt(TextBox61.Text)
myNumber = CInt(TextBox62.Text)
myNumber = CInt(TextBox63.Text)
myNumber = CInt(TextBox64.Text)
myNumber = CInt(TextBox65.Text)
myNumber = CInt(TextBox66.Text)
myNumber = CInt(TextBox67.Text)
myNumber = CInt(TextBox68.Text)
myNumber = CInt(TextBox69.Text)
myNumber = CInt(TextBox70.Text)
myNumber = CInt(TextBox71.Text)
myNumber = CInt(TextBox72.Text)
myNumber = CInt(TextBox73.Text)
Catch
MsgBox(ErrorToString)
End Try
num35 = num1 * num12 - (0.01 * TextBox57.Text * (num1 * num12))
num36 = num2 * num13 - (0.01 * TextBox58.Text * (num2 * num13))
num37 = num3 * num14 - (0.01 * TextBox59.Text * (num3 * num14))
num38 = num4 * num15 - (0.01 * TextBox60.Text * (num4 * num15))
num39 = num5 * num16 - (0.01 * TextBox61.Text * (num5 * num16))
num40 = num6 * num17 - (0.01 * TextBox62.Text * (num6 * num17))
num41 = num7 * num18 - (0.01 * TextBox63.Text * (num7 * num18))
num42 = num8 * num19 - (0.01 * TextBox64.Text * (num8 * num12))
num43 = num9 * num20 - (0.01 * TextBox65.Text * (num9 * num20))
num44 = num10 * num21 - (0.01 * TextBox66.Text * (num10 * num21))
num45 = num11 * num22 - (0.01 * TextBox67.Text * (num11 * num22))
num46 = num23 * num24 - (0.01 * TextBox68.Text * (num23 * num24))
num47 = num25 * num26 - (0.01 * TextBox69.Text * (num25 * num26))
num48 = num27 * num28 - (0.01 * TextBox70.Text * (num27 * num28))
num49 = num29 * num30 - (0.01 * TextBox71.Text * (num29 * num30))
num50 = num31 * num32 - (0.01 * TextBox72.Text * (num31 * num32))
num51 = num33 * num34 - (0.01 * TextBox73.Text * (num33 * num34))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox8.Clear()
TextBox9.Clear()
TextBox10.Clear()
TextBox11.Clear()
TextBox12.Clear()
TextBox13.Clear()
TextBox14.Clear()
TextBox15.Clear()
TextBox16.Clear()
TextBox17.Clear()
TextBox18.Clear()
TextBox19.Clear()
TextBox20.Clear()
TextBox21.Clear()
TextBox22.Clear()
TextBox23.Clear()
TextBox24.Clear()
TextBox25.Clear()
TextBox26.Clear()
TextBox27.Clear()
TextBox28.Clear()
TextBox29.Clear()
TextBox30.Clear()
TextBox31.Clear()
TextBox32.Clear()
TextBox33.Clear()
TextBox34.Clear()
TextBox35.Clear()
TextBox36.Clear()
TextBox37.Clear()
TextBox38.Clear()
TextBox45.Clear()
TextBox46.Clear()
TextBox47.Clear()
TextBox48.Clear()
TextBox49.Clear()
TextBox50.Clear()
TextBox51.Clear()
TextBox52.Clear()
TextBox53.Clear()
TextBox54.Clear()
TextBox55.Clear()
TextBox56.Clear()
TextBox57.Clear()
TextBox58.Clear()
TextBox59.Clear()
TextBox60.Clear()
TextBox61.Clear()
TextBox62.Clear()
TextBox63.Clear()
TextBox64.Clear()
TextBox65.Clear()
TextBox66.Clear()
TextBox67.Clear()
TextBox68.Clear()
TextBox69.Clear()
TextBox70.Clear()
TextBox71.Clear()
TextBox72.Clear()
TextBox73.Clear()
TextBox74.Clear()
TextBox75.Clear()
TextBox76.Clear()
TextBox77.Clear()
TextBox78.Clear()
TextBox79.Clear()
TextBox80.Clear()
TextBox81.Clear()
TextBox82.Clear()
TextBox83.Clear()
TextBox84.Clear()
TextBox85.Clear()
TextBox86.Clear()
TextBox87.Clear()
TextBox88.Clear()
TextBox89.Clear()
TextBox90.Clear()
-
Nov 14th, 2012, 10:06 AM
#10
Re: can someone fix?
See, this is what happens when you 'learn' by simply copying bits and pieces that look like they might work and making no attempt to actually understand anything. In the following few consecutive lines you have both the right way to do it (although not as yet with the necessary validating error handling) and the wrong way to do it. If you had made any attempt to learn the language rather than cobble something together you would not only know the difference, you wouldn't make the mistake in the first place.
myNumber = CInt(TextBox73.Text)
Catch
MsgBox(ErrorToString)
End Try
num35 = num1 * num12 - (0.01 * TextBox57.Text * (num1 * num12))
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 14th, 2012, 10:06 AM
#11
Re: can someone fix?
Oh goody. The forum's randomly spitting out double posts again!
Last edited by dunfiddlin; Nov 14th, 2012 at 10:09 AM.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 14th, 2012, 10:15 AM
#12
Thread Starter
Junior Member
Re: can someone fix?
but i just need this to work.
its my first program and its important.
can you help me with this or fix it for me?
-
Nov 14th, 2012, 11:00 AM
#13
Re: can someone fix?
You have been given more than enough information to 'fix it' yourself. If it's 'important' you shouldn't lack the motivation to do so.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Nov 15th, 2012, 04:13 AM
#14
Re: can someone fix?
Code:
num35 = num1 * num12 - (0.01 * TextBox57.Text * (num1 * num12))
Highlighted in red is one such case where you would get that conversion error. You are multiplying a string by a number. Numbers are supposed to multiplied by numbers.
-
Nov 15th, 2012, 04:23 AM
#15
Thread Starter
Junior Member
Re: can someone fix?
Thanks for the help, i have resolved th problem and its working great
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|