Let me start off by explaining my goals first:
I am trying to create the highest bidder program for a single product: A vase. (There is only one product and the product does not change.)
I have 2 Inputs name and **offer **, I have a label right below it, which by default states (when no offer has yet been made) "There currently has been no offer made ".
Since the first time a user puts in an offer, he is automatically the highest bidder.
The label changes to state the following: "{name} has with {offer} the highest offer.
Now here gets the tricky part I have trouble figuring out how to make my program, compare the next's bidders offer to the previous bidder's offer.
I want it to state if it's lower: "Sorry {previous bidder} has currently the highest {offer}"
And when its higher the previous bidders offer, the label should change to the current bidders offer to be the highest: "{name} has with {offer} the highest offer."
Here is an Image of the WPF
https://i.stack.imgur.com/MqQ21.png
Here is the code: '''
https://ideone.com/e.js/DKVzNG
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void butn1_Click(object sender, RoutedEventArgs e)
{
{
//variabelen
string name = txtbox1.Text;
string txtbod = txtbox2.Text;
string bodtxt = txtbox1.Text;
int bod = Convert.ToInt32(txtbod);
int hoogstebieder = 0;
if (bod > hoogstebieder);
{
labeltext.Content = $" {name} heeft met {bod} het hoogste bod.";
hoogstebieder = bod;
}
else
{
labeltext.Content = "Gelieve een postief getal in te voeren.";
}
if (bod > hoogstebieder)
{
labeltext.Content = $" {name} heeft met {bod} het hoogste bod.";
}
else
{
labeltext.Content = $" {name} heeft met {bod} het hoogste bod.";
}
}
}
}
}
''
Here is the XAML:
'''
https://ideone.com/e.js/AIX1m5
'''
I hope I have well stated my question and not made any newbie mistakes.
I thank you all in advance.