The code I have is:
Dim Dbase() As String = Nothing
Dbase(0) = Db_ComboBox.Text
I have declared Dbase as array and assigned Nothing, Db_ComboBox is a combobox.
For that assignment statement, I’m getting the following error: “Reference ‘Dbase’ has a value of ‘Nothing’“
What is the reason for this error, and how can I take the value from the combobox and save it in the array?
Let’s look at your code:
Especially the first line. That first line creates a variable that can refer to an array, but the
= Nothingportion explicitly tells it, “Do not create a real array here yet”. You have, effectively, a pointer that doesn’t point to anything.I get here that what you really need is a List collection that you can append to over time: