Mam napisac program obliczajacy objetosc ostroslupa. Program dziala, ale oprócz tego musze zapisac wynik obliczen w pliku na dysku c oraz musze miec mozliwosc odczytu tego pliku w programie.
A oto kod programu:
Kod: Zaznacz cały
Imports System.Math
Public Class Form1
Dim Pp, a, b, H, V As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
a = Val(TextBox1.Text)
Pp = a * a
Label5.Text = Str(Pp)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
H = Sqrt(b * b - (a * Sqrt(2) / 2) ^ 2)
Label7.Text = Str(H)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
V = (Pp / 3) * H
Label9.Text = Str(V)
System.IO.File.WriteAllText("c:data.dat", V)
End Sub
Private Sub KoniecToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KoniecToolStripMenuItem1.Click
End
End Sub
End Class
Prosze o pomoc.