Hello to all. How to display the value 12 from textbox1 in the excel file in cell A1. Those. I enter the value in textbox1 and output this value to excel. It prints me instead of 12, this is in cell A1 with the value " System.Windows.Forms.TextBox, Text: 12 ".
The variable int a1 and textbox are declared in partial class Main
like that
private void button1_Click(object sender, EventArgs e) { Microsoft.Office.Interop.Excel.Application ObjExcel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook ObjWorkBook; Microsoft.Office.Interop.Excel.Worksheet ObjWorkSheet; //Книга. ObjWorkBook = ObjExcel.Workbooks.Add(System.Reflection.Missing.Value); //Таблица. ObjWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)ObjWorkBook.Sheets[1]; //Значения [y - строка,x - столбец] ObjWorkSheet.Cells[1, 1] = this.a1; //Вызываем нашу созданную эксельку. ObjExcel.Visible = true; ObjExcel.UserControl = true; }