Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

COMexception was unhandled by user code

$
0
0

Hi,

I'm having this kind of error every time I press the button in my Windows Form which is Insert Citation if the Current List have this bibliography source that has this type of Source "Book Section" , "Web site" , "Document from Web site" and "Patent" the COMException highlighted this

strItems[i - 1] = ssour.Field["Author"] + "; " + ssour.Field["Title"] + "(" + ssour.Field["Year"] + ")";

and this is the code i put in the insert citation button

Word.Application App = Globals.ThisAddIn.Application;
            Word.Document doc = App.ActiveDocument;
            Word.Sources sour = doc.Bibliography.Sources;

                string[] strItems = new string[sour.Count];
                for (int i = 1; i <= sour.Count; i++)
                {
                    Word.Source ssour = sour[i];
                    string tag = ssour.Tag;
                    strItems[i - 1] = ssour.Field["Author"] + "; " + ssour.Field["Title"] + "(" + ssour.Field["Year"] + ")";

                    listBox1.DisplayMember = "Name";
                    listBox1.ValueMember = "Tag";
                    listBox1.Items.Add(new Tagg(strItems[i - 1], tag));
                }

does anyone know how to solve this?

please help me

more power to you guys

god bless us all


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>