Solved

Check Box - For smart ppl

Posted on 2000-04-04
5
142 Views
Last Modified: 2010-05-18
I have a problem. I am new to VB and was hoping if any of you could help me out.

I've created a several check boxes but once my click on the box it carries out my procedure. I would like to reverse his procedure to how it was before i clicked on it.

How can i do this ???

Below is a sample of a coding. Ignore the actual structure.

Within the checkbox click command>>>

Image1.visibility = true
Image2.visibilty = false


When clicked>>>Image1 shows and image 2 disappears.

I would like to reverse the process when i click again.

I would appreciate any help !!!

thank you
0
Comment
Question by:m0ley
  • 3
5 Comments
 
LVL 1

Accepted Solution

by:
riduce earned 50 total points
ID: 2684915
Here is you're answer

Private Sub Check1_Click()
If check1.value = 0 then image1.visible = false: image2.visible = true
if check1.value = 1 then image1.visible = true : image2.visible = false
End Sub
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2684932
Private Sub Form_Load()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not (Check1.Value = vbChecked)
End Sub

Private Sub Check1_Click()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not (Check1.Value = vbChecked)
End Sub
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2684962
A little improvement:

Private Sub Form_Load()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not Image1.Visible
End Sub

Private Sub Check1_Click()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not Image1.Visible
End Sub
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2684975
Even better:

Private Sub Form_Load()
    Check1_Click
End Sub

Private Sub Check1_Click()
    Image1.Visible = (Check1.Value = vbChecked)
    Image2.Visible = Not Image1.Visible
End Sub
0
 

Author Comment

by:m0ley
ID: 2685411
Cheers mate

It worked like a charm !!! :-)

Much appreciated and thank you once again
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now