Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
How to make these in C#
Vlori Veliu
11y
1k
1
Reply
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 ?
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)?????
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 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);
}
}
}
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
disconnecting internet
MSSql server connection failed