Sorry if you already know this, but it is not the class that stores the data unless the members are static. You can make m_sComPort and m_sBaudRate static and access them as DataClass::m_sComPort and DataClass::m_sBaudRate. Otherwise you must be able to access the object instance 'data' from form2.
If you declare DataClass data inside a method or function it will be allocated on the stack and deallocated when the function returns. You can allocate an instance of DataClass on the heap with the 'new' keyword
DataClass* data = new DataClass(); This instance will remain in memory until you do
delete data; Or you can declare 'data' as a global variable or within a context that exists during
the entire lifetime of the process (such as a local variable in the main function).