Answer the question
In order to leave comments, you need to log in
Why is messagebox not working?
I downloaded VSC 2017 and decided to try writing in C#. In the book it is written that at a double click there will be an additional dialog box. But something is not happening.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
MessageBox.Show("Contact List 1.0\nWritten by: 18ko&Ururur", "About");
}
}
}
Answer the question
In order to leave comments, you need to log in
Well... And in the form you created pictureBox ?
And put an event handler on it?
Signed up for an event?
It's either in the VS designer or in code.
1. Select the PictureBox -> In the properties window, the button with a lightning bolt -> in the list, look for the desired event (DoubleClick). (a method will appear in the code)
2
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
pictureBox1.DoubleClick += pictureBox1_Click; //!!!!
}
private void pictureBox1_Click(object sender, EventArgs e)
{
MessageBox.Show("Contact List 1.0\nWritten by: 18ko&Ururur", "About");
}
}
Push pictureBox from the panel on the left onto the form
It will automatically be called pictureBox1
Then set a click event for
it This code will appear itself
private void pictureBox1_Click(object sender, EventArgs e)
{
}
MessageBox.Show("Contact List 1.0\nWritten by: 18ko&Ururur", "About");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question