Option Explicit Private Sub CMD1_Click() On Error GoTo errorhandler Dim abc As Control For Each abc In BPv2.Controls If TypeOf abc Is TextBox Then If abc.Text = "" Then abc.Text = "0" End If End If Next abc Dim Sum1 As Integer Dim Sum2 As Integer Dim Sum3 As Integer Dim Sum4 As Integer Dim Sum5 As Integer Sum1 = Val(TXT1a.Text * txt1d.Text) + (TXT2a.Text * txt2d.Text) + (TXT3a.Text * txt3d.Text) + (TXT4a.Text * txt4d.Text) + (TXT5a.Text * txt5d.Text) + (TXT6a.Text * txt6d.Text) + (TXT7a.Text * txt7d.Text) + (TXT8a.Text * txt8d.Text) + (TXT9a.Text * txt9d.Text) + (TXT10a.Text * txt10d.Text) Label1.Caption = Sum1 Sum2 = Val(TXT1b.Text * txt1d.Text) + (TXT2b.Text * txt2d.Text) + (TXT3b.Text * txt3d.Text) + (TXT4b.Text * txt4d.Text) + (TXT5b.Text * txt5d.Text) + (TXT6b.Text * txt6d.Text) + (TXT7b.Text * txt7d.Text) + (TXT8b.Text * txt8d.Text) + (TXT9b.Text * txt9d.Text) + (TXT10b.Text * txt10d.Text) Label2.Caption = Sum2 Sum3 = Val(TXT1c.Text * txt1d.Text) + (TXT2c.Text * txt2d.Text) + (TXT3c.Text * txt3d.Text) + (TXT4c.Text * txt4d.Text) + (TXT5c.Text * txt5d.Text) + (TXT6c.Text * txt6d.Text) + (TXT7c.Text * txt7d.Text) + (TXT8c.Text * txt8d.Text) + (TXT9c.Text * txt9d.Text) + (TXT10c.Text * txt10d.Text) Label3.Caption = Sum3 Sum4 = Val(txt1d.Text) + (txt2d.Text) + (txt3d.Text) + (txt4d.Text) + (txt5d.Text) + (txt6d.Text) + (txt7d.Text) + (txt8d.Text) + (txt9d.Text) + (txt10d.Text) Label4.Caption = Sum4 Sum5 = Val(TXTcoins.Text) * (Sum4) Label5.Caption = Sum5 Exit Sub errorhandler: MsgBox "Please enter a valid number", vbCritical End Sub Private Sub cmd2_Click() Dim abc As Control For Each abc In BPv2.Controls If TypeOf abc Is TextBox Then If abc.Text <> "" Then abc.Text = "" End If End If Next abc If Label1.Caption <> "" Then Label1.Caption = "" End If If Label2.Caption <> "" Then Label2.Caption = "" End If If Label3.Caption <> "" Then Label3.Caption = "" End If If Label4.Caption <> "" Then Label4.Caption = "" End If If Label5.Caption <> "" Then Label5.Caption = "" End If End Sub Private Sub load_Click() Dim list(5) As String * 10 Dim datafile As String Dim item As Integer Label1.Caption = list(1) Label2.Caption = list(2) Label3.Caption = list(3) Label4.Caption = list(4) Label5.Caption = list(5) datafile = "C:\File.txt" Open datafile For Input As 1 For item = 1 To 5 Input #1, list(item) Next item Close #1 End Sub Private Sub save_Click() Dim list(5) As String * 10 Dim datafile As String Dim item As Integer Cls: Print Print "Text File Maker" 'the list of items list(1) = Label1.Caption list(2) = Label2.Caption list(3) = Label3.Caption list(4) = Label4.Caption list(5) = Label5.Caption Print datafile = "C:\File.txt" 'open the file to receive data Open datafile For Output As 1 For item = 1 To 5 Print #1, list(item) Next item Close #1 End Sub
This post has been edited by darrkwolfy: 20 April 2009 - 10:51 AM

New Topic/Question
Reply




MultiQuote




|