The suggested solution is shown in bold with comments. I hope this may help you.
NextWord.Click += NextWord_Click;
int rowNumber;
string germanCell;
string englishCell;
OpenFileDialog openexcel = new OpenFileDialog();
rowNumber = 2;
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);
CreateCellAddresses();
txtsearchgerman.Text = GetTextFromExcel(germanCell);
txtsearchenglish.Text = GetTextFromExcel(englishCell);
xlWorkBook.Close(true, misValue, misValue);
xlApp.Quit();
xlApp = null;
private void NextWord_Click(object sender, EventArgs e)
{
rowNumber++;
CreateCellAddresses();
txtsearchgerman.Text = GetTextFromExcel(germanCell);
txtsearchenglish.Text = GetTextFromExcel(englishCell);
}
private void CreateCellAddresses()
{
germanCell = string.Format("A{0},A{0}",rowNumber);
englishCell = string.Format("B{0},B{0}",rowNumber);
}
private string GetTextFromExcel(string cellAddress)
{
return (xlWorkSheet.get_Range(cellAddress).Value2.ToString());
}