473,505 Members | 15,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

explain a code

24 New Member
Hello I have a code but i dont understand it. Who can explain it for me with comments. There are three check boxes, three labels and one timer in the form The code:
Dim s As Integer

Private Sub Check1_Click(Index As Integer)
If Check1(Index) = 1 Then
Label1(Index).Visible = True
Else
Label1(Index).Visible = False
End If
End Sub

Private Sub Form_Load()
s = 0
End Sub

Private Sub Timer1_Timer()
j = s
For i = 0 To 2
k = jMod2
Check1(i).Value = k
j = j - k
j = j \ 2
Next i
s = (s + 1) Mod 8
End Sub
Jan 10 '07 #1
1 1500
Killer42
8,435 Recognized Expert Expert
Hello I have a code but i dont understand it. Who can explain it for me with comments. There are three check boxes, three labels and one timer in the form The code:
Expand|Select|Wrap|Line Numbers
  1. Dim s As Integer
  2.  
  3. Private Sub Check1_Click(Index As Integer)
  4.   If Check1(Index) = 1 Then
  5.     Label1(Index).Visible = True
  6.   Else
  7.     Label1(Index).Visible = False
  8.   End If
  9. End Sub
  10.  
  11. Private Sub Form_Load()
  12.   s = 0
  13. End Sub
  14.  
  15. Private Sub Timer1_Timer()
  16.   j = s
  17.   For i = 0 To 2
  18.     k = jMod2
  19.     Check1(i).Value = k
  20.     j = j - k
  21.     j = j \ 2
  22.   Next i
  23.   s = (s + 1) Mod 8
  24. End Sub
You failed to mention that the checkboxes and labels were in two conrtrol arrays. :)

The Check1_Click routine is simply showing or hiding each label when its corresponding checkbox is checked or unchecked, respectively.

The timer appears to be switching between all possible combinations of settings for the three checkboxes.

Note, I believe the "jMod2" is a typo - it almost certainly should be "j Mod 2". At least, I had to change it to get the code to look as though it was working. You really should start your code with "Option Explicit" (or check Tools | Options | Require Variable Declaration) to prevent this sort of glitch.
Jan 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

22
2076
by: Jaspreet | last post by:
I was recently asked this question in an interview. Unfortunately I was not able to answer it and the interviewer made a decision on my C strengths (or weekness) based on this single question and...
10
2107
by: Jeff Boes | last post by:
I'm hoping there's someone here with experience in building the Visual Explain tool from Red Hat. I downloaded it and the J2 SDK, but when I attempt to follow the build instructions, I get messages...
5
3584
by: Jon Lapham | last post by:
I have been using the EXPLAIN ANALYZE command to debug some performance bottlenecks in my database. In doing so, I have found an oddity (to me anyway). The "19ms" total runtime reported below...
4
12692
by: marklawford | last post by:
Not having earned my DBA badge from the scouts just yet I'm a little lost with an error I'm getting. We've just upgraded our development database from 7.2 to 8.2 as the first step in upgrading...
0
1894
by: JAW | last post by:
This plan seems like it should perform well. Does anyone see anything. SQL Statement Text: DECLARE MTR - RDG - EST - CSR CURSOR FOR
11
1783
by: Faisal Vali | last post by:
Hi - I'm new to javascript and I was reading the book Javascript Professional Projects - there is a fragment that has me a little perplexed, and I was wondering if anyone could explain why and how...
5
8073
by: kabotnet | last post by:
Hi, I'm new in db2, I'm trying to execute EXPLAIN command on some queries but i have error like: And message similar to: Token EXPLAIN is not valid, valid tokens ( END GET SET CALL DROP FREE...
3
1447
by: sathishc58 | last post by:
Hi All, Here is the code which generates Segmentation Fault. Can anyone explain why the third printf fails and the first printf works? main() { char ch={"Hello"}; char *p; ...
0
2763
by: LanaR | last post by:
Hello, one sql statement is causing severe performance issue. The problem occurs only in UDB environment, the same statemnt on the mainframe is running fine. I have an explain output from the sql....
1
3558
by: w.l.fischer | last post by:
Hi, the following sequence: set current explain mode yes; set current explain snapshot yes; update ...; set current explain mode no;
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7021
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.