public Boolean TFN() { Boolean tfn_status = false; if (txtTaxFileNumber.Text != null) { int sum = 0; string txtnumber = txtTaxFileNumber.Text; char[] nums = txtnumber.ToCharArray(); int[] WEIGHT = new Int32[8] { 10, 7, 8, 4, 6, 3, 5, 1 }; int val = 0; for (int i = 0; i < nums.Length; i++) { val += ((int)(nums[i])) * WEIGHT[i]; } int remainder = val % 11; if (remainder == 0) { tfn_status = true; } else { tfn_status = false; } } return tfn_status; }
button1_click(object sender,eventArgs e) { Boolean blAns = TFN(); if(blAns) { //to do for Yes } else { //to do for No } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)