Search Results

Search found 2 results on 1 pages for 'user2961971'.

Page 1/1 | 1 

  • Validation Logic

    - by user2961971
    I am trying to create some validation for a form I have. There are two text boxes and two radio buttons on the form. My logic for this validation I know is a little rusty at the moment so any suggestions would be great. Here is the code for what I have so far: Keep in mind that the int errors is a public variable in the class Start Button code: private void btnStart_Click(object sender, EventArgs e) { errors = validateForm(); //Here I want the user to be able to fix any errors where I am little stuck on that logic at the moment //validate the form while (errors > 0) { validateForm(); errors = validateForm(); } } ValidateForm Method: private int validateForm() { errors = 0; //check the form if there are any unentered values if (txtDest.Text == "") { errors++; } if (txtExt.Text == "") { errors++; } if (validateRadioBtns() == true) { errors++; } return errors; } ValidateRadioBtns Method: private Boolean validateRadioBtns() { //flag - false: selected, true: none selected Boolean blnFlag = false; //both of the radio buttons are unchecked if (radAll.Checked == false && radOther.Checked == false) { blnFlag = true; } //check if there is a value entered in the text box if other is checked else if(radOther.Checked == true && txtExt.Text == "") { blnFlag = true; } return blnFlag; } Overall I feel like this can somehow be more stream lined which I am fairly stuck on. Also, I am stuck on how to ensure the user can return to the form, fix the errors, and then validate again to ensure said errors are fixed. Any suggestions would be greatly appreciated since I know this is such a nooby question.

    Read the article

  • Call a function every hour

    - by user2961971
    I am trying to update information from a weather service on my page. The info should be updated every hour on the hour. How exactly do I go about calling a function on the hour every hour? I kind of had an idea but im not sure of how to actually refine it so it works... What I had in mind was something like creating an if statement, such as: (pseudo code) //get the mins of the current time var mins = datetime.mins(); if(mins == "00"){ function(); }

    Read the article

1