| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Edhy Rijo
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: StrataFrame Users 	        
    Posts: 2.4K, 
    Visits: 23K 
    
 
          
		     | 
				                       
                 
                
                    
			            Hi Juan Carlos, Sorry, but I have no idea how to accomplish what you want.  Maybe Trent or somebody else can jump in here.                
			            				
			             Edhy Rijo                     
                     
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Juan Carlos Pazos
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: Forum Members 	        
    Posts: 144, 
    Visits: 227 
    
 
          
		     | 
				                       
                 
                
                    
			            Hi Edji The routine works great thanks. Just a simple question: How do I exclude some fields from being copied? I did in a Maintenance form and works: If col.ColumnName = Me.PublicacionesBO1.PrimaryKeyField ThenContinue ForEnd IfIf col.ColumnName = Me.PublicacionesBO1.Ofertas Then Continue ForEnd If... some other fields here Me .PublicacionesBO1.CurrentRow(col) = copyRow(col) But using the same logic in the ListView, the record is not copied. Do you have some ideas? Regards                
			            
  				
			              Everything is possible, just keep trying...                     
                      
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Edhy Rijo
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: StrataFrame Users 	        
    Posts: 2.4K, 
    Visits: 23K 
    
 
          
		     | 
				                       
                 
                
                    
			            Juan Carlos Pazos (02/15/2009)
 Hi Edhy Thanks for your commentes. Can you post a sample of how to make the EditChildRecord? Regards  Juan Carlos, here ae the two mehods need for this functionality, I simply copied them from the source to the form where the ListView is being used and modified as needed. ''' <summary>''' 09/08/2008 Edhy Rijo''' Edits the currently selected child record''' This method should be use temporarily until the internal one in the listview''' is made available by SF Team''' </summary>''' <remarks></remarks>Private Sub EditChildRecord()     Dim bo As BusinessLayer = Me.lstItems.BusinessObject     '-- If no business object is attached then there is nothing to do     If bo Is Nothing Then Exit Sub'-- See if a snapshot should be taken 
  If Me.lstItems.AutoSnapshotBusinessObject Then bo.SaveCurrentDataTableToSnapshot(Me.lstItems.AutoSnapshotKey) '-- Ensure the the correct record is selected in case it had been moved by the developer               bo.NavigateToPrimaryKey( Me.lstItems.SelectedItems(0).Tag)               '-- Place the record in edit mode               bo.Edit()                '-- See if there is a child dialog               If lstItems.ChildForm IsNot Nothing Then                    '-- Raise the before child form executed event                    ' OnBeforeChildFormExecuted(New ListViewBeforeChildExecuteEventArgs(ListViewChildFormAction.Edit))                    '-- Call the child form and create the args                    Dim args As New MicroFour.StrataFrame.UI.Windows.Forms.ListViewChildFormResultsEventArgs(MicroFour.StrataFrame.UI.ListViewChildFormAction.Edit, Me.lstItems.ChildForm.ShowDialog())                    ''-- Raise the event                    Me.lstItems_ChildFormResults(Me.lstItems, args)                    '-- See if the list should be requeried                    If args.Requery Then                         '-- Save off the primary key value                         Dim reselect As Boolean = True                         Dim pk As Object = Nothing                         Try                              pk = bo.CurrentRow(bo.PrimaryKeyField)                          Catch ex As Exception                              reselect =  False                         End Try                         '-- Requery the list                         Me.lstItems.Requery()                         '-- Attempt to select the item                         If reselect Then SelectIndexByPrimaryKey(pk)                    End If               End IfEnd Sub''' <summary>''' 09/08/2008 Edhy Rijo''' Attempts to select the row index associated with the specified primary key''' This method is used by EditChildRecord''' This method should be use temporarily until the internal one in the listview''' is made available by SF Team''' </summary>''' <param name="primaryKey"></param>''' <remarks></remarks>Private Sub SelectIndexByPrimaryKey(ByVal primaryKey As Object)     For Each i As ListViewItem In Me.lstItems.Items          If i.Tag.Equals(primaryKey) Then               '-- Select the item               i.Selected =  True               '-- Ensure this item is visible               Me.lstItems.EnsureVisible(Me.lstItems.Items.IndexOf(i))               '-- Nothing left to do               Exit For          End If     NextEnd Sub                  
			            				
			            Edhy Rijo                     
                     
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Juan Carlos Pazos
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: Forum Members 	        
    Posts: 144, 
    Visits: 227 
    
 
          
		     | 
				                       
                 
                
                    
			            Hi Edhy Thanks for your commentes. Can you post a sample of how to make the EditChildRecord? Regards                
			            
  				
			              Everything is possible, just keep trying...                     
                      
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Edhy Rijo
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: StrataFrame Users 	        
    Posts: 2.4K, 
    Visits: 23K 
    
 
          
		     | 
				                       
                 
                
                    
			            Here is my implementation of copying the current record into the same business object in a ListView control. Private Sub tsbCopyAndAddRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbCopyAndAddRecord.Click     '-- If there is not item selected in the list, then      '-- instruct the user to select a record first.     If Me.lstItems.SelectedItems.Count = 0 Then          Me.ShowMessageByKey("SelectRecordToCopy")          Exit Sub          End If      Try          '-- Save off the current row          Dim copyRow As DataRow = Me.BizItems1.CurrentRow          If Me.BizItems1.NewRow() Then               '-- Now update each of the columns within the new row.               For Each col As DataColumn In Me.BizItems1.CurrentDataTable.Columns                    '-- Skip the Primary Field, since the field is autoincremented or                    '-- a generated GUID                    If col.ColumnName = Me.BizItems1.PrimaryKeyField Then                         Continue For                    End If                    '-- Do the actual copy of each field or column here.                    Me.BizItems1.CurrentRow(col) = copyRow(col)               Next               '-- Show the ChildForm for the copied record.               Me.EditChildRecord()          End If     Catch ex As Exception     End TryEnd Sub In the above code I am using a method EditChildRecord() that I created from the source code of the listview, which I requested an enhancement to make this method public or shared here http://forum.strataframe.net/Topic19108-9-1.aspx for this kind of functionality.  I am not including my version here since I hope it will be made available to use in the framework.                
			            
  				
			             Edhy Rijo                     
                     
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Edhy Rijo
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: StrataFrame Users 	        
    Posts: 2.4K, 
    Visits: 23K 
    
 
          
		     | 
				                       
                 
                
                    
			            Thanks again, will follow your advice.                
			             				
			            Edhy Rijo                     
                     
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Trent Taylor
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: StrataFrame Developers 	        
    Posts: 6.6K, 
    Visits: 7K 
    
 
          
		     | 
				                       
                 
                
                    
			            There is not a framework function to do this....you are really better off creating a shared method on a class somewhere that does this for you so you can "tweak" it to your needs.  When we started to add this method to the framework, we realized that there would have to be a LOT of overloads to try to accomodate this is a generic method.  It is still on our list, but not in the framework yet.  You can do this yourself very easily using the code supplied in the post.  I recommend created a sealed class to house all of your "basics" and then you could add a static (shared) method to that class to do this for you: Public NotInheritable Class MyBasics     '-- Seal the class     Private Sub New()     End Sub    Public Shared Function CopyRecord(ByVal sourceRow As DataRow) As DataRow       '-- Add the logic from the previous post here with your "tweaks"    End Function End Class                  
			            				
			                                
                     
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Edhy Rijo
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: StrataFrame Users 	        
    Posts: 2.4K, 
    Visits: 23K 
    
 
          
		     | 
				                       
                 
                
                    
			            Trent L. Taylor (03/17/2008)
 I guess I don't know what you are referring to.  You can view the previous post I had here that shows how to copy a record:  http://forum.strataframe.net/FindPost13606.aspx .  This sample code is in VB.NET.  We haven't added a method to the tools class for this.   If this isn't what you are looking for then you might elaborate on what functionality you are trying to implement.  Hi Trent, Yes I am referring to the following code: '-- Save off the current row Dim copyRow As DataRow = MyBo.CurrentRow MyBo.NewRow()'-- Now update each of the columns within the new row.  You may want to test '    on certain column names to be excluded, such as PK fields. For each col as DataColumn In MyBo.CurrentDataTable.Columns     MyBo.Items(col.ColumnName) = copyRow.Item(col.ColumnName)         Next  I just wanted to know if it was added to the framework so I could use it.  I have several address fields which could use this approach to be updated from an existing record.                
			            
  				
			             Edhy Rijo                     
                     
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Trent Taylor
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: StrataFrame Developers 	        
    Posts: 6.6K, 
    Visits: 7K 
    
 
          
		     | 
				                       
                 
                
                    
			            I guess I don't know what you are referring to.  You can view the previous post I had here that shows how to copy a record:  http://forum.strataframe.net/FindPost13606.aspx .  This sample code is in VB.NET.  We haven't added a method to the tools class for this.   If this isn't what you are looking for then you might elaborate on what functionality you are trying to implement.                
			            				
			                                 
                      
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     | 
			
						
	           
    		
	    
				| 
                   
                			                                                     		            
                
                    
                             
                    
                
                Edhy Rijo
                
             | 
				
                
                
                                
               
                	
             | 
			
			
		
				| 
		        
                
 
 
	Group: StrataFrame Users 	        
    Posts: 2.4K, 
    Visits: 23K 
    
 
          
		     | 
				                       
                 
                
                    
			            Trent L. Taylor (01/21/2008)  This is probably something we could add to the Tools.Common class, but just haven't as of yet.Hi Trent, I am looking for the same functionality here but in VB, was this added to SF?                
			            
  				
			             Edhy Rijo                     
                     
                                            
                         
                    
                  
             | 
			
			
        
				|            
                            
		     | 
						
			
			            
           
			    			
                 
                    
                 
		     |