Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, February 23, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Error in IDispatch.invoke while trying to programatically assign DataGrid edit options
Dan Zsiga
Posts: 17
 
Error in IDispatch.invoke while trying to programatically assign DataGrid edit optionsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Jun 11 6:23 AM
fiogf49gjkf0d

Hi All,


I am trying to programmatically assign EditOptions to a DataGrid and get the following error when my function is called:



"Error in IDispatch.Invoke(). Wrong number of arguments or invalid property assignment."



I'm pretty sure this code has worked in the past (I inherited this particular module).  We are running SLX Network version 7.5.2.2151 on Windows 7.  I found a thread that indicates that this may actually represent a message coming from a debugger error that is masking the real error.  In either case, at this point I don't know how to fix it.  The actual code trying to run is:


Sub ValidateGridEditOption(Sender)
    If Form.DataGrid1.Recordset.RecordCount >0 Then
       Form.DataGrid1.EditOptions.ShowDelete = False
    Else
       Form.DataGrid1.EditOptions.ShowDelete = True
    End If
End Sub


The routine is called from both the OnAddedRow and OnDeletedRow events of the DataGrid.  Any advice would be appreciated.  Thank you.


- Dan 

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Error in IDispatch.invoke while trying to programatically assign DataGrid edit optionsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Jun 11 5:23 AM
fiogf49gjkf0d

1. is Form the actual name for the form object that the grid is on? Recommend you left mouse button on the actual form, F4 to show properties and then change the Name property to something special....frmMyFormName....


 


2. Is the 'Form' local to the script? you may not have an actual handle to the 'Form' and may need to walk the Forms Collection and get a reference to the actual 'Form' you are referring to.


Why not just say


gridname.editoptions....... why are you adding 'Form' to the reference?


 


3. you get a different error when you don't have an actual recordset in the grid.....


 


So my guess is that 'Form' is not an actual form name in the Forms collection and you don't have a valid reference to an actual forms object from the forms collection.


 


Sub ValidateGridEditOption(Sender)
    If DataGrid1.Recordset.RecordCount >0 Then
       DataGrid1.EditOptions.ShowDelete = False
    Else
       DataGrid1.EditOptions.ShowDelete = True
    End If
End Sub


 


BTW, in our shop, you name a data grid object DataGrid1 you're out of here......just sayin'


dgProducts grdLeftAccounts, dgUpperContacts, or grdAccounts but never DataGrid1

[Reply][Quote]
Dan Zsiga
Posts: 17
 
Re: Error in IDispatch.invoke while trying to programatically assign DataGrid edit optionsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Jun 11 12:29 PM
fiogf49gjkf0d

Thank you RJ,


Sorry to expose everyone to such horrid naming conventionsEmbarassed.  I agree with your assessment - I don't even use default names for simple labels. I had not seen this particular form code until the error popped up and did not want to mess with fixing object names until I had a handle on the error itself, lest I introduce some new issue.


I tried your suggestion and things do appear to be working now, although I'm a little perplexed if the reference scope was the issue. 'Form' was in fact the name of the form (yuck!) and the intellisense did pick up the object reference chain from there to the grid an then to the recordset and properties. I renamed the form to something properly meaningful and of course the intellisense broke. After removing the form reference from the code, the intellisense returned and the error is no longer appearing.


I did correct all of the object names – so everyone (including me) can sleep better!


Thank you for your help!


 -       Dan


 

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Error in IDispatch.invoke while trying to programatically assign DataGrid edit optionsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Jun 11 8:51 PM
fiogf49gjkf0d

Glad it worked out....there might have been a few dozen objects named form for all we know......and datagrid1.....

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 2/23/2025 10:28:14 PM