[h=5]Plss can u help me about this how to make when I select the Capital City Madrid and City Spain to show me True or when I select Paris and France again True,,, and if I select Paris and Germany to show False ?[/h]
I have written these code but only for Madrid & Spain, how to make it works as well for others ( Paris with France, Berlin with Germany)?????
I have written these code but only for Madrid & Spain, how to make it works as well for others ( Paris with France, Berlin with Germany)?????
C#:
[/FONT][/COLOR][COLOR=#333333][FONT=lucida grande] [/FONT][/COLOR][COLOR=#333333][FONT=lucida grande]namespace example1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
listBox1.Items.Add("Madrid"); listBox1.Items.Add("Paris"); listBox1.Items.Add("Berlin");
listBox2.Items.Add("France"); listBox2.Items.Add("Germany"); listBox2.Items.Add("Spain");
}
private void ptToolStripMenuItem_Click(object sender, EventArgs e)
{
listBox1.Font = new Font(listBox1.Font.FontFamily, 20);
listBox2.Font = new Font(listBox2.Font.FontFamily, 20);
}
private void button1_Click(object sender, EventArgs e)
{
if ((string)listBox1.SelectedItem == "Madrid" && (string)listBox2.SelectedItem == "Spain")
MessageBox.Show("True","",MessageBoxButtons.OK, MessageBoxIcon.Information);
else
MessageBox.Show("False", "",MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}[/FONT][/COLOR][COLOR=#333333][FONT=lucida grande]