soluzione sistema lineare con visual basic
VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} UserForm1 Caption = "UserForm1" ClientHeight = 4530 ClientLeft = 45 ClientTop = 330 ClientWidth = 7845 OleObjectBlob = "sistema2.frx":0000 StartUpPosition = 1 'CenterOwner End Attribute VB_Name = "UserForm1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit
Private Sub CommandButton1_Click() Dim a(2), b(2), c(2) As Integer Dim x, y As Double Dim ds, dx, dy As Double a(1) = TextBox1.Text a(2) = TextBox4.Text b(1) = TextBox2.Text b(2) = TextBox5.Text c(1) = TextBox3.Text c(2) = TextBox6.Text ds = a(1) * b(2) - a(2) * b(1) dx = c(1) * b(2) - c(2) * b(1) dy = a(1) * c(2) - a(2) * c(1) Label1.Caption = "ds=" & ds Label2.Caption = "dx=" & dx Label3.Caption = "dy=" & dy Select Case ds Case Is <> 0 x = dx / ds y = dy / ds Label4.Caption = "x=" & x Label5.Caption = "y=" & y Case Is = 0 If (dx = 0) And (dy = 0) Then Label4.Caption = "indeterminato" Else Label4.Caption = "impossibile" End If End Select
CommandButton2.SetFocus End Sub
Private Sub CommandButton2_Click() TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" Label1.Caption = "" Label2.Caption = "" Label3.Caption = "" Label4.Caption = "" Label5.Caption = "" TextBox1.SetFocus
End Sub
Private Sub UserForm_Click()
End Sub