Hi i am open a excel file and it automatically open first two cell A1,B2 in two text boxes.
now i want how to open different cells in different click of button.
i am using this code-
OpenFileDialog openexcel = new OpenFileDialog();
openexcel.Title = "Mayank";
openexcel.InitialDirectory = @"c:\";
openexcel.RestoreDirectory = true;
openexcel.DefaultExt = ".xls";
openexcel.Filter = "xls files (*.xls)|*.xls|All files (*.*)|*.*";
openexcel.FilterIndex = 2;
if (openexcel.ShowDialog() == DialogResult.OK)
{
Excel.Application xlApp;
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
object filename = openexcel.FileName;
object misValue = System.Reflection.Missing.Value;
xlApp = new Excel.ApplicationClass();
xlWorkBook = xlApp.Workbooks.Open(filename.ToString(), misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
//xlApp.Visible = true;
txtsearchgerman.Text = (xlWorkSheet.get_Range("A2", "A2").Value2.ToString());
txtsearchenglish.Text = (xlWorkSheet.get_Range("B2", "B2").Value2.ToString());
xlWorkBook.Close(true, misValue, misValue);
xlApp.Quit();
xlApp = null;
Thanks in Advance.