Reputation: 2216
I want to calculate the amout of some Entry's with this, the total of 2 Entry's . That works with a ButtonClick event.
private void Rekenklik(object sender, EventArgs e)
{
var t1 = Decimal.Parse(Ebb1.Text);
var t2 = Decimal.Parse(Ebb2.Text);
var total = t1 + t2;
string totleString1 = total.ToString();
int length1 = totleString1.Length;
Totaal.Text = length1 > 3 ? totleString1.Insert(length1 - 3, ",") : totleString1;
}
I also use want put this in with a CheckBoxChanged event.
<CheckBox
x:Name="Cbbb1"
Grid.Row="0"
Grid.Column="0"
CheckedChanged="Cbbb1_CheckedChanged" />
In Maui
it is giving a Error on Rekenklik();
when i use it in CheckChanged
event.
private void Cbbb1_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
{
if (e.Value)
{
Ebb1.Text = "754831";
}
else
{
Ebb1.Text = "0";
}
Rekenklik(); ///////// Error on this
}
}
Error CS7036 There is no argument given that corresponds to the required formal parameter 'sender' of 'MainPage.Rekenklik(object, EventArgs)' Testing (net6.0-android), Testing (net6.0-ios), Testing (net6.0-maccatalyst), Testing (net6.0-windows10.0.19041) G:\source\Testing\Testing\MainPage.xaml.cs 33 Active
When i use Rekenklik(); with a ButtonClick it works , but i want to used to with a CheckBox.
Is Maui
not ready for this or am i doing something wrong ?
Using Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.1.0 Preview 1.1
Upvotes: 0
Views: 110
Reputation: 2216
Found it , i forgot to remove this object sender, EventArgs e
public void Rekenklik()
{
var t1 = Decimal.Parse(Ebb1.Text);
var t2 = Decimal.Parse(Ebb2.Text);
var total = t1 + t2;
string totleString1 = total.ToString();
int length1 = totleString1.Length;
Totaal.Text = length1 > 3 ? totleString1.Insert(length1 - 3, ",") : totleString1;
}
Upvotes: 0