VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   4740
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6210
   LinkTopic       =   "Form1"
   ScaleHeight     =   4740
   ScaleWidth      =   6210
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command3 
      Caption         =   "Command3"
      Height          =   495
      Left            =   2520
      TabIndex        =   12
      Top             =   3840
      Width           =   1500
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Command2"
      Height          =   495
      Left            =   4200
      TabIndex        =   11
      Top             =   3840
      Width           =   1500
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   495
      Left            =   300
      TabIndex        =   5
      Top             =   3840
      Width           =   2000
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   4200
      TabIndex        =   3
      Text            =   "Text4"
      Top             =   2640
      Width           =   1500
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   4200
      TabIndex        =   2
      Text            =   "Text3"
      Top             =   2040
      Width           =   1500
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   4200
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   1400
      Width           =   1500
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   4200
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   840
      Width           =   1500
   End
   Begin VB.Label Label7 
      Caption         =   "Label7"
      Height          =   495
      Left            =   240
      TabIndex        =   13
      Top             =   240
      Width           =   5415
   End
   Begin VB.Label Label6 
      Caption         =   "Label6"
      Height          =   375
      Left            =   240
      TabIndex        =   10
      Top             =   3240
      Width           =   2805
   End
   Begin VB.Label Label5 
      Caption         =   "Label5"
      Height          =   375
      Left            =   240
      TabIndex        =   9
      Top             =   2640
      Width           =   2805
   End
   Begin VB.Label Label4 
      Caption         =   "Label4"
      Height          =   375
      Left            =   240
      TabIndex        =   8
      Top             =   2040
      Width           =   2805
   End
   Begin VB.Label Label3 
      Caption         =   "Label3"
      Height          =   375
      Left            =   240
      TabIndex        =   7
      Top             =   1440
      Width           =   2805
   End
   Begin VB.Label Label2 
      Caption         =   "Label2"
      Height          =   375
      Left            =   240
      TabIndex        =   6
      Top             =   840
      Width           =   2805
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   375
      Left            =   4200
      TabIndex        =   4
      Top             =   3240
      Width           =   1500
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim kmmost As Single
Dim kmmultkor As Single
Dim benzinar As Single
Dim fizetett As Single
Dim fogyasztas As Single
Dim szeles As Integer



Private Sub Command1_Click()
kmmultkor = Val(Text1.Text)
kmmost = Val(Text2.Text)
benzinar = Val(Text3.Text)
fizetett = Val(Text4.Text)

If (kmmost - kmmultkor) > 0 Then
fogyasztas = (fizetett / benzinar) / ((kmmost - kmmultkor) * 0.01)
Label1.Caption = fogyasztas
Else
Label1.Caption = "Hiba"
End If
If kmmultkor < 0 Then Label1.Caption = "Hiba"
If kmmultkor < 0 Then Label7.Caption = "Nem lehetett negativ km óra állás"
If kmmost < 0 Then Label1.Caption = "Hiba"
If kmmost < 0 Then Label7.Caption = "Nem lehet negativ km óra állás"
If benzinar < 0 Then Label1.Caption = "Hiba"
If benzinar < 0 Then Label7.Caption = "Nem lehet negativ benzin ár"
If kmmultkor > kmmost Then Label1.Caption = "Hiba"
If kmmultkor > kmmost And kmmost > 0 Then Label7.Caption = "Nem keverted össz a km-óra állásokat?"
If kmmultkor = kmmost Then Label1.Caption = "Hiba"
If kmmultkor = kmmost Then Label7.Caption = "Ellenőrizd a bevitt km óra állásokat! Nem tettél meg egy km-t sem a két tankolás közben?"
If fizetett = 0 Then Label1.Caption = "Hiba"
If fizetett = 0 Then Label7.Caption = "A benzint nem kaphattad ingyen!"
If fizetett < 0 Then Label1.Caption = "Hiba"
If fizetett < 0 Then Label7.Caption = "A benzint nem kaphattad negativ pénzért!"
If fogyasztas < 0 Then Label1.Caption = "Hiba"
If fogyasztas < 0 Then Label7.Caption = "A fogyasztásod nem lehet nulla, vagy negativ"
If fogyasztas > 0 Then Label7.Caption = ""

Command3.Caption = "Újraszámolás"

End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Command3_Click()
Call Form_Load
End Sub


Private Sub Form_Load()
Form1.Caption = "Fogyasztás számolása"
Label1.Caption = ""
Label2.Caption = "Km óra állása az előző tankolásnál:"
Label3.Caption = "Km óra állása a mostani tankolásnál:"
Label4.Caption = "Benzinár Ft/liter-ben:"
Label5.Caption = "Tankoláskor fizetett összeg:"
Label6.Caption = "Fogyasztás(liter/100 km):"
Label7.Caption = "Üdvözöllek az átlagfogyasztást számoló programban. Kérlek figyelj az adatok pontos megadásánál!"
Command1.Caption = "Számold ki a fogyasztást"
Command2.Caption = "Kilépés"
Command3.Caption = " "
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub

Private Sub Form_Resize()
szeles = Command2.Left + Command2.Width + 500
If Form1.ScaleWidth < szeles Then Form1.Width = szeles + 100
If Form1.ScaleHeight < Command1.Top + Command1.Height + 100 Then
Form1.Height = Command1.Top + Command1.Height + 950
End If

End Sub

