Hallo,
ich habe mal aus Langeweile so einen Einkaufslistenersteller erstellt und habe nun das Problem, dass er Zahlen mit einem Komma nicht richtig rechnet.
Weiß jemand woran es liegt?
Skript :
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Global $VGesamtpreis = 0,$VArtikelGesamt = 0
$MainGUI = GUICreate("Einkaufslistenersteller", 615, 459, 192, 124)
$LName = GUICtrlCreateLabel("Name der Ware", 8, 8, 93, 17)
$IName = GUICtrlCreateInput("", 104, 8, 329, 21)
$LPreis = GUICtrlCreateLabel("Preis", 448, 8, 27, 17)
$IPreis = GUICtrlCreateInput("", 480, 8, 121, 21)
$LKommentar = GUICtrlCreateLabel("Kommentar", 8, 48, 57, 17)
$IKommentar = GUICtrlCreateInput("", 80, 48, 521, 21)
$BHinzufugen = GUICtrlCreateButton("hinzufügen", 528, 88, 75, 25)
$ListAll = GUICtrlCreateListView("Name | Preis | Kommentar ", 8, 120, 593, 331)
$LGesamtpreis = GUICtrlCreateLabel("Gesamtpreis : 0,00 €", 8, 88, 198, 17)
$LArtikelAktuell = GUICtrlCreateLabel("Aktuelle Anzahl der Artikel : 0", 216, 88, 271, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $BHinzufugen
_Add()
EndSwitch
WEnd
Func _Add()
GUICtrlCreateListViewItem(GuiCtrlRead($IName) & ' | ' & GuiCtrlRead($IPreis) & ' | ' & GuiCtrlRead($IKommentar), $ListAll)
$Split = StringSplit(GuiCtrlRead($IPreis),",")
If UBound($Split) > 2 Then
$VGesamtpreis += $Split[1] & "," & $Split[2]
Else
$VGesamtpreis += GuiCtrlRead($IPreis)
EndIf
$VArtikelGesamt += 1
GuiCtrlSetData($LGesamtpreis,"Gesamtpreis : " & $VGesamtpreis & "€")
GuiCtrlSetData($LArtikelAktuell,"Aktuelle Anzahl der Artikel : " & $VArtikelGesamt)
EndFunc
MfG , Julien