View Single Post
  #1  
Old 27-11-2016, 11:09
FaneDuru FaneDuru is offline
Member
 
Join Date: May 2012
Posts: 35
Question How to use foreach (in C#) to iterate through Documents collection?

How can enumerate each (open) document from Documents Collection using C#?
I try something like that, but the line containing 'corel.Documents' is red:
Code:
using corel = Corel.Interop.VGCore;
 namespace DockerTest
 {
     public partial class DockerUI : UserControl
    {
        private corel.Application corelApp;
        public DockerUI(corel.Application app)
        {
            this.corelApp = app;
            InitializeComponent();
        }
         
        private void Button_Click(object sender, RoutedEventArgs e)
        {
              foreach (corel.Document d in corel.Documents) //problem...
                {
                    MessageBox.Show(d.Name);
                }
    }
}
I use Mcrosoft Visual Studio 13 and it sais: 'Corel.Interop.VGCore.Documents' is a 'type', which is not valid in the given context.

How to make it 'understand' that corel.Documents is a collection...?

Thanks in advance!
Reply With Quote