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
| Imports System.IO
Public Class Form1
Const PATHFICHIER As String = "Resultat.txt"
Dim PATHRESULTAT As String = "Resultat.Dat"
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Label5.Visible = False
Me.Label5.ForeColor = Color.Red
End Sub
Private Sub QuitterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitterToolStripMenuItem.Click
If MsgBox("Souhaitez-vous vraiment quitter ce programme ?", 36, "Quitter") = MsgBoxResult.Yes Then
End
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TextBox1.Text = ""
Me.TextBox2.Text = ""
Me.ComboBox1.SelectedIndex = -1
Me.ComboBox2.SelectedIndex = -1
End Sub
Function Verification() As Boolean
Dim Bon As Boolean = True
If Me.TextBox1.Text Is Nothing Or Not IsNumeric(Me.TextBox1.Text) Then
Bon = False
End If
Return Bon
End Function
Function Calcul(ByVal TextBox1 As Double, ByVal ComboBox1 As Double, ByVal ComboBox2 As Double) As Double
Dim D As Double = TextBox1
Dim z As Integer = 0
While z <> ComboBox2
D = D * (1 + ComboBox1 / 100)
z = z + 1
End While
Return D
End Function
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If Verification() Then
Me.TextBox2.Text = Calcul(Me.TextBox1.Text, Me.ComboBox1.Text, Me.ComboBox2.Text)
Else
Me.Label5.Visible = True
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
File.WriteAllText(PATHFICHIER, "Capital Initial :" & Me.TextBox1.Text & vbNewLine & "Taux :" & Me.ComboBox1.Text & "%" & vbNewLine & "Nombre d'années :" & Me.ComboBox2.Text & vbNewLine & "Capital final:" & Me.TextBox2.Text)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
File.AppendAllText(PATHRESULTAT, Me.TextBox1.Text & " " & Me.ComboBox1.Text & " " & Me.ComboBox2.Text & " " & Me.TextBox2.Text & vbNewLine)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
File.ReadAllText (Resultat.Dat,Integer) = ( Me.TextBox1.Text , Me.ComboBox1.Text , Me.ComboBox2.Text , Me.TextBox2.Text )
Do Until EOF(f)
???????????????
??????????????????????????????
End Sub
End Class |
Partager