Solved

Check Box - For smart ppl

Posted on 2000-04-04
5
143 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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA: Select SQL query based on a config Sheet v2 11 44
Macro Excel - Multiple If conditions 2 73
VB 6 error 5 in windows 10 but not in XP 7 57
Excel Automation VBA 19 74
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

831 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