VB计算器程序到PowerPoint

时间:2018-02-09 06:33:54

标签: vb.net

美好的一天,我在Visual Basic 2010中创建了一个简单的计算器程序,有没有办法自动将结果数据导出到PowerPoint幻灯片中?

    Imports System.Math
Public Class Form1

    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        Dim Consumption As Double, Days As Double, Hours As Double, Efficiency As Double
        Dim Res1 As Double, Res2 As Double, Res3 As Double, Harvest As Double
        Dim Hundred As Double, SeventyFive As Double, Fifty As Double
        Dim USD As Double, PHP As Double
        Dim input As Double
        Dim totcost As Double, one As Double, two As Double, three As Double
        Dim FinHundred As Double, FinSeventyFive As Double, FinFifty As Double
        Dim dailykwh As Double, dailybill As Double
        Dim kwhfifty As Double, kwhseven As Double, kwhone As Double
        Dim savefifty As Double, saveseven As Double, saveone As Double



        If txtCons.Text = Nothing Then

            totcost = kwhcost.Text

            input = txtrate.Text

            Days = 30
            Hours = 8
            Efficiency = 0.6

            USD = 2000000
            PHP = 50

            Consumption = totcost / input

            Res1 = Consumption / Days
            Res2 = Res1 / Hours
            Res3 = Res2 / Efficiency
            Harvest = Res3 * 6

            txt30.Text = Format(Res1, "Standard")
            txt8.Text = Format(Res2, "Standard")
            txtEff.Text = Format(Res3, "Standard")
            txtHarvest.Text = Format(Harvest, "Standard")

            Hundred = (Res3 / 1000) * USD * PHP
            SeventyFive = ((Res3 * 0.75) / 1000) * USD * PHP
            Fifty = ((Res3 * 0.5) / 1000) * USD * PHP

            txtHundred.Text = Format(Hundred, "Standard")
            txtSeventyFive.Text = Format(SeventyFive, "Standard")
            txtFifty.Text = Format(Fifty, "Standard")

            totcost = Consumption * input
            one = ((Hundred / (totcost * 1)) / 12)
            two = ((SeventyFive / (totcost * 0.75)) / 12)
            three = ((Fifty / (totcost * 0.5)) / 12)

            kwhcost.Text = Format(totcost, "Standard")
            a.Text = Format(one, "Standard")
            b.Text = Format(two, "Standard")
            c.Text = Format(three, "Standard")

            FinHundred = (Hundred / (totcost * 0.5) / 12)
            FinSeventyFive = (SeventyFive / (totcost * 0.5) / 12)
            FinFifty = (Fifty / (totcost * 0.5) / 12)

            txtFinHundred.Text = Format(FinHundred, "Standard")
            txtFinSeventyFive.Text = Format(FinSeventyFive, "Standard")
            txtFinFifty.Text = Format(FinFifty, "Standard")

            dailykwh = Consumption / 30
            dailybill = totcost / 30

            txtDailyCons.Text = Format(dailykwh, "Standard")
            txtDailyBill.Text = Format(dailybill, "Standard")

            kwhfifty = Harvest * 0.5
            kwhseven = Harvest * 0.75
            kwhone = Harvest * 1

            txtCap50.Text = Format(kwhfifty, "Standard")
            txtCap75.Text = Format(kwhseven, "Standard")
            txtCap100.Text = Format(kwhone, "Standard")

            savefifty = totcost * 0.5
            saveseven = totcost * 0.75
            saveone = totcost * 1

            txtSavings50.Text = Format(savefifty, "Standard")
            txtSavings75.Text = Format(saveseven, "Standard")
            txtSavings100.Text = Format(saveone, "Standard")

            txtCons.Text = Format(Consumption, "Standard")
        ElseIf kwhcost.Text = Nothing Then

            input = txtrate.Text

            Consumption = txtCons.Text
            Days = 30
            Hours = 8
            Efficiency = 0.6

            USD = 2000000
            PHP = 50



            Res1 = Consumption / Days
            Res2 = Res1 / Hours
            Res3 = Res2 / Efficiency
            Harvest = Res3 * 6

            txt30.Text = Format(Res1, "Standard")
            txt8.Text = Format(Res2, "Standard")
            txtEff.Text = Format(Res3, "Standard")
            txtHarvest.Text = Format(Harvest, "Standard")

            Hundred = (Res3 / 1000) * USD * PHP
            SeventyFive = ((Res3 * 0.75) / 1000) * USD * PHP
            Fifty = ((Res3 * 0.5) / 1000) * USD * PHP

            txtHundred.Text = Format(Hundred, "Standard")
            txtSeventyFive.Text = Format(SeventyFive, "Standard")
            txtFifty.Text = Format(Fifty, "Standard")

            totcost = Consumption * input
            one = ((Hundred / (totcost * 1)) / 12)
            two = ((SeventyFive / (totcost * 0.75)) / 12)
            three = ((Fifty / (totcost * 0.5)) / 12)

            kwhcost.Text = Format(totcost, "Standard")
            a.Text = Format(one, "Standard")
            b.Text = Format(two, "Standard")
            c.Text = Format(three, "Standard")

            FinHundred = (Hundred / (totcost * 0.5) / 12)
            FinSeventyFive = (SeventyFive / (totcost * 0.5) / 12)
            FinFifty = (Fifty / (totcost * 0.5) / 12)

            txtFinHundred.Text = Format(FinHundred, "Standard")
            txtFinSeventyFive.Text = Format(FinSeventyFive, "Standard")
            txtFinFifty.Text = Format(FinFifty, "Standard")

            dailykwh = Consumption / 30
            dailybill = totcost / 30

            txtDailyCons.Text = Format(dailykwh, "Standard")
            txtDailyBill.Text = Format(dailybill, "Standard")

            kwhfifty = Harvest * 0.5
            kwhseven = Harvest * 0.75
            kwhone = Harvest * 1

            txtCap50.Text = Format(kwhfifty, "Standard")
            txtCap75.Text = Format(kwhseven, "Standard")
            txtCap100.Text = Format(kwhone, "Standard")

            savefifty = totcost * 0.5
            saveseven = totcost * 0.75
            saveone = totcost * 1

            txtSavings50.Text = Format(savefifty, "Standard")
            txtSavings75.Text = Format(saveseven, "Standard")
            txtSavings100.Text = Format(saveone, "Standard")

        ElseIf txtrate.Text = Nothing Then
            MsgBox("Please Input Rate")


        End If




    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtCons.Clear()
        txt30.Clear()
        txt8.Clear()
        txtEff.Clear()
        txtHarvest.Clear()
        kwhcost.Clear()
        a.Clear()
        b.Clear()
        c.Clear()
        txtHundred.Clear()
        txtSeventyFive.Clear()
        txtFifty.Clear()
        txtrate.Clear()
        txtFinHundred.Clear()
        txtFinSeventyFive.Clear()
        txtFinFifty.Clear()
        txtCap50.Clear()
        txtCap75.Clear()
        txtCap100.Clear()
        txtSavings50.Clear()
        txtSavings75.Clear()
        txtSavings100.Clear()
        txtDailyCons.Clear()
        txtDailyBill.Clear()
    End Sub
End Class

正如您所看到的,有多个计算及其相应的输出,我需要做的是将结果传输到Excel或Powerpoint中的表中以用于演示目的。

0 个答案:

没有答案