ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   C# IMdcCheckBox.Value problem (https://www.excelbanter.com/excel-programming/295186-c-imdccheckbox-value-problem.html)

Jim McLeod

C# IMdcCheckBox.Value problem
 
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.M issing)
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_Valu e()' or 'Microsoft.Vbe.Interop.Forms.IMdcCheckBox.set_Valu e(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



All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com