This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

How do I copy objects inside one thumbnail viewer to another?

Hi,

I have the following code to copy one thumbnail object to another and it doesn't seem to work. what am I doing wrong?

    Private Sub AddFileToFilesList(ByVal filename As String)
        Dim filePidls(0) As Aurigma.GraphicsMill.WinControls.Pidl
        filePidls(0) = Aurigma.GraphicsMill.WinControls.Pidl.Create(filename)

        Dim listItems As Aurigma.GraphicsMill.WinControls.ThumbnailListItem() = Aurigma.GraphicsMill.WinControls.ThumbnailListItem.Create(filePidls)
        ThumbnailListView1.Items.Add(listItems)
    End Sub

    Private Sub AddFileToQueue(ByVal Listitem As ThumbnailListItem)
        ThumbnailListView2.Items.Add(Listitem)
    End Sub

    Private Sub UFlatButton7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UFlatButton7.Click
        If Not ThumbnailListView1.SelectedItems Is Nothing Then
            For Each item As ThumbnailListItem In ThumbnailListView1.SelectedItems
                ThumbnailListView2.Items.Add(item.Clone)
            Next
        End If
    End Sub
Hello,

It is very strange, the code you have posted works correctly in my sample. Could you provide us with more information regarding to error? Which behaviour have you got? Are thumbnails not showing or they haven't copied at all? Could you send us sample project for debugging.
It works but I get thsi error
System.InvalidOperationException was unhandled
  Message="Cross-thread operation not valid: Control 'ThumbnailListView2' accessed from a thread other than the thread it was created on."
  Source="System.Windows.Forms"
  StackTrace:
       at System.Windows.Forms.Control.get_Handle()
       at Aurigma.GraphicsMill.WinControls.VirtualListView.GetItemRect(Int32 itemIndex)
       at Aurigma.GraphicsMill.WinControls.VirtualListView.UpdateColumnWidth(Int32 itemIndex)
       at Aurigma.GraphicsMill.WinControls.VirtualListView.TextChanged(Object sender, TextChangedEventArgs args)
       at Aurigma.GraphicsMill.WinControls.ListItemCollection.FireTextChanged(IListItem item, Int32 textInfoId)
       at Aurigma.GraphicsMill.WinControls.ListItemCollection.TextChangedInternal(Object sender, TextChangedEventArgs e)
       at Aurigma.GraphicsMill.WinControls.ListItem.FireTextChanged(Int32 textInfoId)
       at Aurigma.GraphicsMill.WinControls.ThumbnailListItem.FireEvalMethod0Events()
       at Aurigma.GraphicsMill.WinControls.ThumbnailListItem.EvaluateMethod(Int32 methodIndex)
       at Aurigma.GraphicsMill.WinControls.Queue.EvaluateQueue()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

I got it working. Its something to do with VS2005.
I had to do
    Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Control.CheckForIllegalCrossThreadCalls = False
    End Sub


Is there anyway to make it so what ever i Add is not already inside there already?
basically dont allow duplicate.
Hello,

Thank you for the solution with VS2005 you have described. As for the question - could you give more detailed description of the problem? Unfortunatelly I have not understood you.