How to serialize Forms in vb.net? -


below code serialize object. need serialize form , save in configuration of application.

i have set breakpoint , noticed returns nothing or null (3rd line in code below)

public function serializeobject(byval o object) string     if not o.gettype().isserializable         return nothing     end if      using stream new memorystream()         dim ser new system.runtime.serialization.formatters.binary.binaryformatter         ser.serialize(stream, o)         messagebox.show(convert.tobase64string(stream.toarray))         return convert.tobase64string(stream.toarray)     end using end function 

if there alternative, love know more.

forms in .net not serializable, reason hold handle window. handle valid here (on session on computer) , (if close application in ten minutes handle won't valid anymore).

therefore handles cannot serialized , neither can forms.

the idea work around :

  • you serialize form yourself, selecting values want save
  • you create class serializable , class create form when has been serialized...

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -