Click here to Skip to main content
15,914,488 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
private FileInfo[] files;
       private string cgItemID = "";

       private int adimgseqposX = 50;
       private int adimgseqposY = 50;
       private string AdimgseqID = "";
       private void button1_Click(object sender, EventArgs e)
       {

           string AdimgseqID = "";
           int adimgseqposX = 50;
           int adimgseqposY = 50;
           if (m_strImagePath == null || m_strImagePath == string.Empty)
           {
           }
           System.Windows.Forms.FolderBrowserDialog openFolder = new System.Windows.Forms.FolderBrowserDialog();
           //System.Windows.Forms.DialogResult reopenFoldersult = openFolder.ShowDialog();
           if (openFolder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
           {
               DirectoryInfo di = new DirectoryInfo(openFolder.SelectedPath);
               files = di.GetFiles();
               m_objEditor.CGObject.AddNewItem(files[0], adimgseqposX, adimgseqposY, 0, 1, ref cgItemID);
               m_objEditor.UpdateItemsList();
           }
       }
       private int counter = 0;
       private void timer1_Tick(object sender, EventArgs e)
       {
           counter++;

           int index = counter % files.Count(); // to avoid outOfIndex errors

           m_objEditor.CGObject.AddNewItem(files[0], adimgseqposX, adimgseqposY, 0, 1, ref cgItemID);

           string propertyName = "img::path";

           string propertyValue = files[index];

           int timeForChange = 0;

           string changeType = "";

           m_objEditor.CGObject.SetItemProperties(cgItemID, propertyName, propertyValue, changeType, timeForChange);


       }
   }


What I have tried:

you need the FullName of the FileInfo objects.
Replace files[0] with files[0].FullName
And files[i] with files[i].FullName
Posted
Updated 10-May-21 8:06am
v2
Comments
Richard MacCutchan 10-May-21 8:56am    
You could do that yourself with any editor.
Jnkukka 10-May-21 8:59am    
I am using Visual studio 2019, What is FullName of the FileInfo objects.
Richard MacCutchan 10-May-21 10:12am    
I do not know what you mean; maybe you need to consult the documentation: FileInfo Class (System.IO) | Microsoft Docs[^].
Dave Kreskowiak 10-May-21 14:15pm    
They hide that information in the documentation:
FileSystemInfo.FullName Property (System.IO) | Microsoft Docs[^]

No, because we have no idea what it is supposed to do, or what problem you have encountered.

And ... We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
The is the FileInfo collection:
private FileInfo[] files;

It's telling you to reference the "FullName" property of the FileInfo object; not the object itself.
m_objEditor.CGObject.AddNewItem(files[0].FullName, adimgseqposX, adimgseqposY, 0, 1, ref cgItemID);

...
string propertyValue = files[index].FullName;
 
Share this answer
 
Comments
Jnkukka 11-May-21 2:12am    
I am change my code like this but show a error.
System.ArgumentNullException: 'Value cannot be null.
Parameter name: source

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900