'Random_Number_File_Writer.Form1' does not contain a definition for 'saveFileDialog1_FileOk' and no extension method 'saveFileDialog1)_FileOk' accepting a first argument of type 'Random_Number_File_Writer.Form1' could be found (are you missing a using directive or an assembly reference?)
That, is the error message that I am getting. I tried going to my college's lab for assistance, but the person is not familiar with C# and it took us around an hour just to get my line numbers showing (just for reference...) And then I went to my professor and he said he was going to be busy for a while.. So I thought I'd try here as an alternate source of help.
I looked at the questions already on here regarding similar errors, but it still leaves me puzzled as how to correct this one in particular, and as I referenced the code in my textbook as closely as possible, I'm not sure I understand why I'm even getting this error.
Here's the code, and I'm sorry if it's difficult to read. Oh, and I know that this is the part generating the error, because I had it running yesterday, WITHOUT this part. But part of the assignment is having the save as dialog.
try
{
//Initial opening point for save file dialogue
saveFileDialog1.InitialDirectory = @"C:\Users\Heather\Documents\Visual Studio 2010\Projects\Random Number File Writer";
//Save As popup - Opening the file for writing usage once it's created.
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
randomNumberFile = File.CreateText(openFileDialog1.FileName);
}
else // Popup informing user that the data will not save to a file because they didn't save.
{
MessageBox.Show("You elected not to save your data.");
}
here's the using stuff that didn't format:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO; // Added to be able to use StreamWriter variable type
And here is the code snippet it gives when I double click and it takes me to the Form1.Designer.CS window.
this.saveFileDialog1.FileOk += new System.ComponentModel.CancelEventHandler(this.saveFileDialog1_FileOk);