G
garyusenet
This is the first time i've worked with openfile dialog.
I'm getting a couple of errors with my very basic code.
Can someone point out the errors in what i've done please.
==========================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MyNewProject
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string file;
FileOpen();
}
private void FileOpen()
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
file = openfiledialog1.FileName;
}
}
}
}
Problems : -
=============
Warning 1 The variable 'file' is declared but never used
Error 2 The name 'file' does not exist in the current context
Error 3 The name 'openfiledialog1' does not exist in the current
context
TIA
Gary
I'm getting a couple of errors with my very basic code.
Can someone point out the errors in what i've done please.
==========================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MyNewProject
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string file;
FileOpen();
}
private void FileOpen()
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
file = openfiledialog1.FileName;
}
}
}
}
Problems : -
=============
Warning 1 The variable 'file' is declared but never used
Error 2 The name 'file' does not exist in the current context
Error 3 The name 'openfiledialog1' does not exist in the current
context
TIA
Gary