VB.net modifying a form from another form
Posted on 2003-12-01
I have a main form called MainScreen. I have a listbox in this MainScreen that I am trying to update from another form(form2). I am clicking a button in form2, and I want it to add something to the listbox in MainScreen. I have tried just doing MainScreen.listbox.items.add("FFFF"), but that doesn't seem to work. I have also tried creating variables of type MainScreen and doing it that way, but I get an error(Object reference not set to an instance of an object). I have also tried creating a function in MainScreen:
Public Sub AddItemToList(ByVal listitem As String)
and calling that function from form2, but get that same error.
Should I be making MainScreen the parent of form2 somehow? Any help would be appreciated.