テキストボックスのデータを Excel ファイルに挿入する際に問題が発生します...表示され続けるエラーを以下に示します。xls
データをファイルに正常に挿入するには、どのような変更を行う必要がありますか?
エラー:
Property, indexer, or event 'Range' is not supported by the language; try directly calling accessor method 'Microsoft.Office.Interop.Excel._Worksheet.get_Range(object, object)'
private void btnAdd_Click(object sender, EventArgs e)
{
int _lastRow = xlWorkSheet.Range["A"+xlWorkSheet.Rows.Count].End[Excel.XlDirection.xlUp].Row + 1 ;
xlWorkSheet.Cells[_lastRow, 1] = textBox1.Text;
xlWorkSheet.Cells[_lastRow, 2] = textBox2.Text;
xlWorkSheet.Cells[_lastRow, 3] = textBox3.Text;
xlWorkSheet.Cells[_lastRow, 4] = textBox4.Text;
エラーは次の行で発生します。
int _lastRow = xlWorkSheet.Range["A"+xlWorkSheet.Rows.Count].End[Excel.XlDirection.xlUp].Row + 1 ;