wusher
wusher

Reputation: 12441

Problems casting an ComObject in VB.net

I have a Word.Field object which is a checkbox and the Type property equals wdFieldFormCheckBox. I am trying to cast the Word.Field object as Word.CheckBox object but I am getting casting errors.

Dim chkBox as Word.CheckBox
chkBox = DirectCast( myFieldInstance, Word.Checkbox)

How do I cast a Word.Field object into Word.CheckBox object?

Upvotes: 2

Views: 384

Answers (1)

Dirk Vollmar
Dirk Vollmar

Reputation: 176169

This is not possible. CheckBox is a property of a FormField object and not a field object.

Upvotes: 1

Related Questions