Posted: 3 Oct 2017 12:04 EDT Last activity: 6 Nov 2018 20:02 EST
How do you set a value to null?
I need to clear the DataSource property on a combo box. In C# this can be achieved by writing:
comboBox.DataSource = null;
In Robotis Studio, I achieved the same by creating a script. I also can create an uninitialized variable and pass it as the data source. Both work, but neither area ideal. Is there a better way to set a value to null?
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
I don't think there is a "correct" way of doing it. I came up with adding a hidden Combobox on my Windows Form. By default, the DataSource is null so I pass the DataSource from my hidden Combobox to the Combobox that I want to be null.
Another method would be to pass an empty array into the DataSource, which will also clear the items in the Combobox.