Hi @Mohamed Rafi N ,
Your main mistake is not figuring out the data type.
radioButton and checkBox1 are bool types
and need to use true
or false
literals to initialize bool variables or pass bool values.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool
You need to decide whether to choose.
if (comboBox1.Text != "" && comboBox1.Text != "" && textBox1.Text != "" && (checkBox1.Checked || checkBox2.Checked) && (radioButton1.Checked || radioButton2.Checked))
bool quality = radioButton1.Checked || radioButton2.Checked;
bool taste = checkBox1.Checked || checkBox2.Checked;
comboBox1.Text is of type string
and cannot be directly equal to type int
(mentioned in the previous question), it needs to be converted using Convert.ToInt32 Method
.
https://learn.microsoft.com/en-us/dotnet/api/system.convert.toint32?view=net-6.0
int year = Convert.ToInt32(comboBox2.Text);
I recommend you to read more basic documentation to write better code.
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.