Answered by:
Checking if check box value exists in database

Question
-
Hi
I am doing my project in vb.net.
i have a checkbox on a form, which is of type boolean in the database .
when the user check the checkbox, before the data enters the database, the program should check if there exists already a "1" on the database for this field.
If so the user is not allowed to check the depot.
I am having problem coding this.
Any help will be highly appreciated.
ThanksTuesday, January 17, 2012 2:42 PM
Answers
-
Hello,
I understand that you want to display a form and enable a field depending on the value of a boolean in the database.
In this case, you want to read some fields in the DB and display the form, based on the values of what has come from the database. If you want to prevent a field value to be changed, just disable it on your form.
Which part of this code are you having problems with ? Reading the data ? Displaying the form ? Disabling a control ?
- Proposed as answer by Mark Liu-lxfModerator Thursday, January 19, 2012 7:53 AM
- Marked as answer by nirvana.r Thursday, January 19, 2012 12:53 PM
Tuesday, January 17, 2012 3:03 PM
All replies
-
Hi,
It's best to tell us what you tried and what is the error message you get. For example there is several way to access data in a db and we have no idea which one you choosed.
Technically speaking this is likely a boolean (true/false) rather than the "1" string or the numeric value 1. Could it be that you try to compare different datatypes ?
Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".Tuesday, January 17, 2012 3:00 PM -
Hello,
I understand that you want to display a form and enable a field depending on the value of a boolean in the database.
In this case, you want to read some fields in the DB and display the form, based on the values of what has come from the database. If you want to prevent a field value to be changed, just disable it on your form.
Which part of this code are you having problems with ? Reading the data ? Displaying the form ? Disabling a control ?
- Proposed as answer by Mark Liu-lxfModerator Thursday, January 19, 2012 7:53 AM
- Marked as answer by nirvana.r Thursday, January 19, 2012 12:53 PM
Tuesday, January 17, 2012 3:03 PM -
Hi nirvana,
Welcome to the MSDN forum.
As Patrice and Sygrien mentioned, more information is needed to solve your issue. According your description, just disable the control if the data in database is 1 (suggested by Sygrien) seems to be a solution.
I look forward to your reply.
Mark Liu-lxf [MSFT]
MSDN Community Support | Feedback to us
Thursday, January 19, 2012 7:53 AMModerator -
Hello everyone :)
thanks a lot for all your replies...i managed to solve the problem, i did just did disabled the checkbox whenever the data in the database is found to be a "1".
what i want to know now is can we make a rounded button in vb.net? What i want is to have rounded command buttons for add and delete procedure.
Thanks.Thursday, January 19, 2012 12:48 PM -
Hi nirvana,
There is no round button provided by Microsoft, but you can code it by yourself. Here is a sample code about Round Button in Control.Region Property: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.region.aspx
If you have any additional questions, please feel free to let me know.
Mark Liu-lxf [MSFT]
MSDN Community Support | Feedback to us
- Edited by Mark Liu-lxfModerator Friday, January 20, 2012 7:42 AM
Friday, January 20, 2012 7:42 AMModerator