Removing UserDataSource from a form
I call a UserDataSource like this:
dsQuestions = objForm.DataSources.UserDataSources.Add("Questions", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 254)
Is there anyway to remove "myData" from the form after I'm done with it? I would like to re-use the DataSource, but I get an error that the DataSource already exists when I do.
And yes, I can instantiate another DataSource. I just didn't want my code (and the system resources) to fill up with stuff that I don't need.
PS - releasing dsQuestions using:
System.Runtime.InteropServices.Marshal.ReleaseComObject(dsQuestions) dsQuestions = Nothing GC.Collect()
Vishnu Kumar Reddy replied
you can add userdatasource only once to a form, it is just like a hidden item on the form.
once you are done with your business logic with the userdatasource,you reset it to some default value(myDatasource.valueEx="").
you can again use that when needed(myDatasource.valueEx=NewValue).
No need to add it again to the form as long as the form is alive the datasource will be with it.