By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,052 Members | 1,456 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,052 IT Pros & Developers. It's quick & easy.

CommandButton Caption

P: n/a
Hey!
i have a c# program opening and creating powerpoint slides and i
created a commandbutton on the slide. the problem i'm having is
changing the caption of the button.
i've placed the code below and the only error is
objValue.Caption="Values". when i run the program, the powerpoint
crashes at that command.
PowerPoint.Shape vButton = newSlide.Shapes.AddOLEObject(10, 500, 100,
30,"Forms.CommandButton.1",null,MsoTriState.msoFal se,null,0,null,MsoTriState.msoFalse);
vButton.Name = "cmdValue";
MSForms.CommandButton vButtObj =
(MSForms.CommandButton)vButton.OLEFormat.Object;
vButtObj.Caption = "Values";

any idea on what i'm doing wrong?

Sep 29 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
finally figured it out.. and hope this helps someone.. :)

PowerPoint.Shape vButton = currentSlide.Shapes.AddOLEObject(10, 500,
60, 30, "Forms.CommandButton.1", null, MsoTriState.msoFalse, null, 0,
null, MsoTriState.msoFalse);
vButton.Name = "cmdValues";
MSForms.CommandButton vButtObj =
(MSForms.CommandButton)vButton.OLEFormat.Object;
vButton.GetType().InvokeMember("Caption", BindingFlags.SetProperty,
null, vButtObj, new object[] { "Values" });

Oct 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.