Step 8 of the first tutorial (http://msdn.microsoft.com/en-us/library/dd492131.aspx#footerLink)
will not compile
namespace
PictureViewer
{
public
partial
class
Form1
: Form
{
public
Form1()
{
InitializeComponent();
}
private
void
showButton_Click(object
sender, EventArgs
e)
{
// Show the Open File dialog. If the user clicks
OK, load the
// picture that the user chose.
if
(openFileDialog1.ShowDialog() == DialogResult.OK)
{
pictureBox1.Load(openFileDialog1.FileName);
}
}
it always throws an error;
Error 1 'PictureViewer.Form1' does not contain a definition for 'openFileDialog1_FileOk' and no extension method 'openFileDialog1_FileOk' accepting a first argument of type 'PictureViewer.Form1' could be found (are you missing a using directive
or an assembly reference?) C:\Documents and Settings\Home User\my documents\visual studio 2010\Projects\PictureViewer\PictureViewer\Form1.Designer.cs 148 94 PictureViewer
This is as if I had not performed Step 7 where the OpenFileDialog is inserted, yet it has been and is visible and shows up in the Form1.Designer.cs;
private
System.Windows.Forms.TableLayoutPanel
tableLayoutPanel1;
private
System.Windows.Forms.PictureBox
pictureBox1;
private
System.Windows.Forms.CheckBox
checkBox1;
private
System.Windows.Forms.FlowLayoutPanel
flowLayoutPanel1;
private
System.Windows.Forms.Button
showButton;
private
System.Windows.Forms.Button
clearButton;
private
System.Windows.Forms.Button
backgroundButton;
private
System.Windows.Forms.Button
closeButton;
private
System.Windows.Forms.ColorDialog
colorDialog1;
private
System.Windows.Forms.OpenFileDialog
openFileDialog1;
}
}
There is a suppoed fix posted on tyhe tutorial community section, but it seems to be for VB, not C# and it is refuted by someone else.