vb.net - visual basic 2010 would a class or structure be better in this use case -


as mentioned before, hardly programmer, once again need expertise of are...

i working on program me manage data volunteer emergency communications group. in program have multiple different structures built multiple different objects (if using term correctly). have structure site personnel, structure members (yes different), structure operation info (considered own object), , structure facility. fine , well, having each element of structure defined <vbfixedstring(nameofconstant)> ensure equal record length.

and hit problem. each object (again hope i'm not butchering term calling facility or site personnel etc 'object') set of fields random access file (i abandoned excel file idea, way headache , nothing failures on front, i'll use in-house system). and, of dismays, did decide go fileopen, fileget, fileput, etc random access file management (i can hear teeth grinding , skulls crackling epic facepalms, believe me need go simple presentation version , version 1 release beta tested @ national disaster medical system exercise in may). problem encountered each file need own filenumber, own position, , on, , each 1 need dim temp <structure> <structure> sitepersonnel, opinfo, memberdata, or other relevant structure. each file need own file handling controls, such getrecord, putrecord, deleterecord, nextrecord, previousrecord, addrecord, , on, , each file need own functions file opening , finding last record. reason each structure need own copies of code cannot find way pass in variable module-level function such public function fileopener(byval filenum integer, byval structurename string, byval filename string, byval accesstype string) , in code define dim temp (structurename) structurename string value actual name of structure. , finally, decided have redundant file handlers in each object since @ time there can 2 or more of these file open, reading, writing, , seeking. last thing need during emergency module-level function confused , return wrong data.

now have background, need advice. aware structures can have functions, code each of these functions structure. however, have started thinking object complex , can many different things may belong in class instead of structure. not familiar classes in visual basic, familiar classes java, if there similarity between 2 on oop level. question this: example better (and more reliably) handled in structure, or in class? , if in class, best off each class in own file, or should combine of these classes 1 module (mainly clarity , ease of maintenance)?

i apologize again permanent damage have caused here sub-newbieness , painful choice of code, , thank ahead of time helping sorta-noob swing of things (last visual basic program wrote when visual basic 4 hot off press, yep, long...).

for system yours, manage users , other objects, recommend use of classes. used management system offer abbility of hierachical variables , functions, don't accidentaly call internal function or access variable shouldn't. also, classes more flexible structurs, should preferable use them when aren't sure wether class or structure better way.

as plutonix pointed out before, not platform recommendations, problems code. next time, please go vb.net forum. text written above opinion based on knowledge the difference between classes , structures , msdn-article. further internetresearch still should do, maybe ask in forum or friends / other programmers know.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -