C# IMdcCheckBox.Value problem

J

Jim McLeod

Hi Guys

Would it be possible for you to explain the method used to set an Excel checkbox in C#. The code I have developed to create and place the checkbox within the worksheet is below

/****
Excel.OLEObjects OleObjectsObject = (Excel.OLEObjects)ExcelWorkSheet.OLEObjects(Type.Missing)
Excel.OLEObject OleControl = OleObjectsObject.Add("Forms.CheckBox.1", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, StartLeft, InternalStartTop, 130, 10);

MSForms.CheckBox MyCheckBox
MyCheckBox = (MSForms.CheckBox)base.FindControl(OleControl.Name, ExcelWorkSheet)
/****

However, when trying to set the value of MyCheckBox.Value to true I am told the following

"Property, indexer, or event 'Value' is not supported by the language; try directly calling accessor methods 'Microsoft.Vbe.Interop.Forms.IMdcCheckBox.get_Value()' or 'Microsoft.Vbe.Interop.Forms.IMdcCheckBox.set_Value(ref object)'

This is where I am stuck.... I can't access the methods connected to this interface

If you could shed some light on this problem I would appreciate the advice

Regards

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top