Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get value of checked box in vb.net

Posted on 2006-07-20
2
Medium Priority
?
170 Views
Last Modified: 2010-04-23
I want to populate a bit field in my sql database with the value 0 or 1 if a checkbox has been checked.   I was using cb1.text but that is not working.

Any help would be great!   Thanks


 Dim cmd7 As New SqlClient.SqlCommand("INSERT INTO tblEvalsurvey (Q1,q21, q22, q23, q24, q25,q26, q27, q28, q29, q210, q211, q212, q213, q214, q215,q2other, q3, q3other, q41, q42, q43, q44, q45, q46, q47, q5, q6,q7,q8,q9) VALUES ('" & rbl1.SelectedValue & "', '" & cb1.Text & "', '" & cb2.Text & "', '" & cb3.Text & "', '" & cb4.Text & "', '" & cb5.Text & "', '" & cb6.Text & "', '" & cb7.Text & "', '" & cb8.Text & "', '" & cb9.Text & "', '" & cb10.Text & "', '" & cb11.Text & "' , '" & cb12.Text & "', '" & cb13.Text & "', '" & cb14.Text & "', '" & cb15.Text & "', '" & text2.Text & "', '" & rbl3.SelectedValue & "', '" & txt3.Text & "', '" & rb41.SelectedValue & "', '" & rb42.SelectedValue & "', '" & rb43.SelectedValue & "', '" & rb44.SelectedValue & "', '" & rb45.SelectedValue & "', '" & rb46.SelectedValue & "', '" & rb47.SelectedValue & "', '" & rbl5.SelectedValue & "', '" & rbl6.SelectedValue & "', '" & txt7.Text & "', '" & txt8.Text & "', '" & txt9.Text & "')", Connection1)
0
Comment
Question by:running32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 2000 total points
ID: 17146850
Try using an IIf:

..., '" & IIf(cb7.Checked,1,0) & "',...
0
 

Author Comment

by:running32
ID: 17147078
Great, thanks
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question