system project problem
hey everyone! I'm a C# beginner and I'm having some problems on my system code (It's a billing system). Every time I click total, always shows that I need to put a cash amount, idk if this is an window popup error (this also my problem on my login and register password hashing even though I followed it). Does anyone willing to help and teach me how I can fix this? Thanks in advance and have a great day! 😸
16 Replies
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/Show the code for your total button click event handler
And maybe a screenshot of the UI, preferably with the error
BlazeBin - jajfmgopkrsa
A tool for sharing your source code with the world!

ok so
if (decimal.TryParse(textBox6.Text, out cashReceived))
is failing
that means textbox6.Text
wasnt a valid numberoh dang
im assuming that the one next to the "cash" button?
yes
well its blank on that screenshot
blank is indeed not a valid number
wait so I should put 0 first before I click the total?
my mind currently blanking rn I'm so sorry
Sure
You could default the value to 0 as well
wait how?
Set the text property on the text box to 0 in the winforms designer
Did you write the code btw?
Or ai generate it
i wrote it but when i get an error i fix it with ai
it would also be better if u check if the Text is empty or null before u use, there is no telling what the user will do
such as deleting the input
before u try to parse it