copy and pest
inside a method eg button click
private void button1_Click(object sender, EventArgs e)
{
DialogResult result=dialog.ShowDialog();
if(result==DialogResult.OK)
{
buff=System.IO.File.ReadAllBytes(dialog.FileName);
labelfilename.Text=dialog.FileName;
}
}
otherwise
OpenFileDialog dialog;
DialogResult result=dialog.ShowDialog();
if(result==DialogResult.OK)
{
buff=System.IO.File.ReadAllBytes(dialog.FileName);
labelfilename.Text=dialog.FileName;
}