943,920 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 3213
  • VB.NET RSS
Oct 8th, 2007
0

Checkbox on database

Expand Post »
Hi there

I'm now using Microsoft Access and i have a column called VT. I stored it into a variable called vibrotactile.

vibrotactile = ds.Tables("maskingSimulator").Rows(s).Item("VT")

The problem is the column contains checkboxes. If my VT column is not checked, it will carry out Case 1. Else, if my VT column is checked, it will carry out Case 2. How do i put it into codes? I tried to put 'if vibrotactile = false' and 'if vibrotactile = true'. But it doesn't seem to work. How do i go about it?

VB.NET Syntax (Toggle Plain Text)
  1.  
  2. If vibrotactile = False Then
  3. 'Case 1
  4. acTestEarThreshold = acTestEarThreshold
  5. End If
  6.  
  7. If vibrotactile = True Then
  8. 'Case 2
  9. If acTestEarThreshold <= 20 Then
  10. acTestEarThreshold = acTestEarThreshold
  11.  
  12. ElseIf acTestEarThreshold > 20 Then
  13. acTestEarThreshold = 20
  14. End If
  15. End If
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mustoora is offline Offline
23 posts
since Jul 2007
Oct 9th, 2007
0

Re: Checkbox on database

Click to Expand / Collapse  Quote originally posted by mustoora ...
Hi there

I'm now using Microsoft Access and i have a column called VT. I stored it into a variable called vibrotactile.

vibrotactile = ds.Tables("maskingSimulator").Rows(s).Item("VT")

The problem is the column contains checkboxes. If my VT column is not checked, it will carry out Case 1. Else, if my VT column is checked, it will carry out Case 2. How do i put it into codes? I tried to put 'if vibrotactile = false' and 'if vibrotactile = true'. But it doesn't seem to work. How do i go about it?

VB.NET Syntax (Toggle Plain Text)
  1.  
  2. If vibrotactile = False Then
  3. 'Case 1
  4. acTestEarThreshold = acTestEarThreshold
  5. End If
  6.  
  7. If vibrotactile = True Then
  8. 'Case 2
  9. If acTestEarThreshold <= 20 Then
  10. acTestEarThreshold = acTestEarThreshold
  11.  
  12. ElseIf acTestEarThreshold > 20 Then
  13. acTestEarThreshold = 20
  14. End If
  15. End If

You haven't mentioned or used the checkbox any where in your code. Any ways, Your check box may got some other ID but Im using here yourCheckBox as an ID.

So Now,

If vibrotactile.yourCheckBox.checked = False Then
'Case 1
acTestEarThreshold = acTestEarThreshold
End If

If vibrotactile.yourCheckBox.checked = True Then
'Case 2
If acTestEarThreshold <= 20 Then
acTestEarThreshold = acTestEarThreshold

ElseIf acTestEarThreshold > 20 Then
acTestEarThreshold = 20
End If
End If



I Hope it'll work.
Reputation Points: 10
Solved Threads: 0
Light Poster
shikeb is offline Offline
26 posts
since Jul 2007
Oct 9th, 2007
0

Re: Checkbox on database

Hi

What is the type of column "VT"; if it is not of type "bit" probably the FALSE - TRUE statements won't work. Otherwise it should work.

I make the same evaluation but i use a dataview instead and it works fine, but I don't see any reason it would not work with the table directly.
Reputation Points: 23
Solved Threads: 10
Junior Poster
williamrojas78 is offline Offline
111 posts
since Jun 2005
Oct 10th, 2007
0

Re: Checkbox on database

Hi

thanks for replying. I tried putting the checkbox ID but it doesn't work. Wriggly lines appeared. It says 'VT is not a member of string'. I declared 'vibrotactile' as String. Is it correct?

I checked the properties of my 'VT' column. The data type states that 'Yes/No'.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mustoora is offline Offline
23 posts
since Jul 2007
Oct 10th, 2007
0

Re: Checkbox on database

Hi,

have ya tried to convert it to boolean ... because the True false property of CheckBox only works in that condition.
Reputation Points: 10
Solved Threads: 0
Light Poster
shikeb is offline Offline
26 posts
since Jul 2007
Oct 10th, 2007
0

Re: Checkbox on database

Hi again,
fortunately I managed to run it ... but i did it in C#, its like this,

VB.NET Syntax (Toggle Plain Text)
  1. if (vibrotactile.myCheckBox.Checked == false)
  2. {
  3. acTestEarThreshold = acTestEarThreshold;
  4. }
  5. else
  6. {
  7. If (acTestEarThreshold <= 20)
  8. {
  9. acTestEarThreshold = acTestEarThreshold;
  10. }
  11. else
  12. {
  13. acTestEarThreshold = 20;
  14. }
  15.  
  16. }

It was working fine.
I Hope you'll get something out from it and that it'll work for you.
Reputation Points: 10
Solved Threads: 0
Light Poster
shikeb is offline Offline
26 posts
since Jul 2007
Oct 18th, 2007
0

Re: Checkbox on database

Hi

thanks for the help. Really appreciate it. I've managed to get it out. Here's what i did to it


VB.NET Syntax (Toggle Plain Text)
  1. If vibrotactile Then
  2. 'Case 2
  3. If acTestEarThreshold <= 20 Then
  4. acTestEarThreshold = acTestEarThreshold
  5.  
  6. ElseIf acTestEarThreshold > 20 Then
  7. acTestEarThreshold = 20
  8. End If
  9.  
  10. Else
  11. 'Case 1
  12. acTestEarThreshold = acTestEarThreshold
  13. End If
  14.  
  15. End If
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mustoora is offline Offline
23 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Crystal report setconnection and parameter problem
Next Thread in VB.NET Forum Timeline: Audio file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC