2 Replies - 301 Views - Last Post: 22 July 2013 - 07:17 PM Rate Topic: -----

#1 AirlynKhey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-July 13

Text box is null

Posted 22 July 2013 - 06:26 PM

I'm New to C#,my code does not work. If all of my text boxes are null and I press Save button it will save in the database.How to do it that When one of my text box is null and when i press the button save it will not save in my database and there should be a message that that field is required
Is This A Good Question/Topic? 0
  • +

Replies To: Text box is null

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9204
  • View blog
  • Posts: 34,582
  • Joined: 12-June 08

Re: Text box is null

Posted 22 July 2013 - 07:11 PM

Make a 'validation' function that returns a boolean.. inside said method have it check for your X amount of textboxes.. if anyone is null then return false.. if none are null return true..

Wrap your 'save to database' call in an if statement that checks the boolean of the function outlined above.. if true then save.. if false then throw up an error message.
Was This Post Helpful? 0
  • +
  • -

#3 AirlynKhey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-July 13

Re: Text box is null

Posted 22 July 2013 - 07:17 PM

Thank you
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1