Vb.net code for a checking a number whether it is prime or not is very simple just write following code on any event on which you want to check the number.For better understanding of these type of vb.net code or database related inquiry the book written by Mike Murach is very good book which is available on amazon with free shipping charge, I will suggest one can be refer