vb.net - Calling setMethod doesn't work to change Boolean value VB -
i have 2 classes, main class , class calculating numbers. i'm working radio buttons chose either male or female have field boolean maintain track if female or male chosen. field called isfemale want phone call set method main class calculating depending on radio button chose , depending on chose calculates values different between male , female. problem somehow calling set method main class doesn't alter isfemale field in calculation class. here code:
if btnfemale.checked = true bmrcalc.setgender(true) messagebox.show("woman") elseif btnmale.checked = true messagebox.show("man") bmrcalc.setgender(false) end if as can see i've included message boxes create sure radiobuttons work , do. problem bmrcalc.setgender(boolean). doesn't alter boolean false true or vice versa no matter radio button chose. default boolean can't alter somehow. bmrcalc object works fine. have other set method double works. boolean doesn't work somehow..
here field:
private isfemale boolean in calculation class and here setmethod in calculation class:
public sub setgender(byref female boolean) isfemale = female end sub summary of problem is: calling set method in main class not alter boolean value in calculating class instance field
i hope idea. i'm using vb
i've tried code , appears functional. sure you're reading boolean value correctly after has been set? seek debugging code step-by-step and/or utilize watches.
as dave suggested, utilize enum instead of boolean:
private _gender gender public sub setgender(byref gender gender) _gender = gender end sub public enum gender male female end enum you can set like:
bmrcalc.setgender(bmrcalc.gender.male) bmrcalc.setgender(bmrcalc.gender.female) vb.net visual-studio methods boolean
No comments:
Post a Comment