I want my code to be able to execute a command if the comboBox is equal to a certain variable. It’s basically if combobox = 0 then excel will change the cell value to 0. The problem is that the if statement It is not properly formatted. Thanks for any help
if (comboBox1.SelectedText == "0")
var xl = new Excel.Application();
xl.Visible = true;
var wb = (Excel._Workbook)(xl.Workbooks.Add(Missing.Value));
var sheet = (Excel._Worksheet)wb.ActiveSheet;
sheet.Cells[4, 6] = "0";
You are missing {}. This shold be all right.
If there is more then one command following If statement, you have to use {}.