I think you need give pointer on MainForm object to your optionDialog and then use this pointer.