private void btnBrowse_Click(object sender, EventArgs e)
{
ofBrowse.ShowDialog();
}
private void ofBrowse_FileOk(object sender, CancelEventArgs e)
{
txtFile.Text = ofBrowse.FileName;
}
To Open It
if (File.Exists(txtFile.Text))
{
if (txtSheetName.Text.Trim() == "")
{
MessageBox.Show("Please enter Sheet Name", "Sheet Name Required", MessageBoxButtons.OK, MessageBoxIcon.Information);
txtSheetName.Select();
txtSheetName.Focus();
return;
}
ds = new DataSet();
Data.Fill(ds);
ddlParameter.Items.Clear();
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[i][1].ToString().Trim() != "")
ddlParameter.Items.Add(ds.Tables[0].Rows[i][1].ToString().Trim());
if (ddlParameter.Items.Count > 0)
ddlParameter.SelectedIndex = 0;
}
}