Hy Everyone,
I would like to control my excel sheet checkbox with radiobutton. I am able to open up a pre-set excel document (.xls/.xlsx) and change particular cells using:
private void button_export_Click(object sender, EventArgs e)
{
xlexcel = new Excel.Application();
xlexcel.Visible = true;
// Open a File
xlWorkBook = xlexcel.Workbooks.Open(@"C:\Users\h109536\Documents\PSW.xlsx", 0, true, 5, "", "", true,
Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
// Customer Name/Division
xlWorkSheet.Cells[12, 20] = textBox6.Text;
// Procurement
xlWorkSheet.Cells[18, 20] = checkedListBox_comodity.Text;
// Date Created
xlWorkSheet.Cells[85, 34] = dateTimePicker_datecreated.Text;
//… etc
}
private void radioButton_lvl1_CheckedChanged(object sender, EventArgs e)
{
if (this.radioButton_lvl1.Checked) { this.PPAPlevel = "level 1"; }
SetButton();
}
I have come across Radio Buttons
and Check Boxes
and would like to change those values in the current excel sheet using my GUI. So if something in my C# GUI is checked or enabled, the radio buttons/check boxes in the excel file will change accordingly.
Any input would be appreciated!
Aucun commentaire:
Enregistrer un commentaire