| | |
Issues with check boxes
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Apr 2006
Posts: 30
Reputation:
Solved Threads: 0
As far as I know when a check box is check the value should be 1 and when it is not checked it should be 0 correct?
In my case if I don't check the box its null and if I do its -1
Here is my code
now i put -1 for the values and it worked but if i didnt check them some were 0 and some were null
if i have both check boxes checked it works
returns -1 for both
but if i just check one of the boxes it returns -1 and Null
ive tried -1 and Null, -1 and "", -1 and 0
In my case if I don't check the box its null and if I do its -1
Here is my code
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub AddGeneral() Dim rsAdd As Recordset Dim sql As String If (chk1.checkstate = 1 And chk2.checkstate = 1) Then Kidney = "Both" MsgBox "Checked" ElseIf (chk1.Value = 1 And chk2.Value = "") Then Kidney = "Self" ElseIf (chk1.Value = "" And chk2.Value = 1) Then Kidney = "Family" Else Kidney = "" End If If (chk3.Value = 1 And chk4.Value = 1) Then Head = "Both" ElseIf (chk3.Value = 1 And chk4.Value = 0) Then Head = "Self" ElseIf (chk3.Value = 0 And chk4.Value = 1) Then Head = "Family" Else Head = "" End If
now i put -1 for the values and it worked but if i didnt check them some were 0 and some were null
if i have both check boxes checked it works
returns -1 for both
but if i just check one of the boxes it returns -1 and Null
ive tried -1 and Null, -1 and "", -1 and 0
Last edited by Stewie; Aug 30th, 2006 at 12:59 pm.
I can't really tell by your code, but is this VB express, .NET, or Legacy (VB 4, 5, or 6)? If it's Legacy VB, could you attach the project in a .zip to your next post, so that I can download your code, and see your problem. The truth is, I can't even replicate your error. I'm guessing, since vb6 doesn't have a .checkstate property for checkboxes, that it's not VB6. Something to check, and I see (based on your question) why you would have done this, but you are testing the checkboxes .value property against an empty string (""). Something to consider, would be testing against vbnull or vbnullstring.
![]() |
Similar Threads
- select check boxes (ASP.NET)
- retreive and update from check boxes (ColdFusion)
- Select all check boxes in datgrid by one check box outside thegrid (ASP.NET)
- Please Check this HJT Log!!! (Viruses, Spyware and other Nasties)
- bridge.dll cannot be found when booting up, rundll32 not responding when shutting dow (Viruses, Spyware and other Nasties)
- Anybody know what this log is? (Viruses, Spyware and other Nasties)
- BRIDGE.DLL issues. Please help. (Windows NT / 2000 / XP)
- IE6 - dialogue boxes , check boxes and radio buttons work very slowly after hijacking (Viruses, Spyware and other Nasties)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: visual basic 6 decompiler
- Next Thread: How do I populate multiple column list box?
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






