473,657 Members | 2,422 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(In dex As Integer)
If Check1(Index) = 1 Then
Label1(Index).V isible = True
Else
Label1(Index).V isible = 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 1505
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
2095
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 that was a sad end to my interview. Here is the program: #include <stdio.h> int main() { char *c ="abc";
10
2139
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 like: error: Type `JTableHeader' not found in the declaration of the local variable `header'. JTableHeader header = null; To me, this indicates that the SDK isn't installed (properly). But I admit I'm pretty much a Java...
5
3616
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 actually takes 25 seconds on my computer (no other CPU intensive processes running). Is this normal for EXPLAIN ANALYZE to report a total runtime so vastly different from wall clock time? During the "explain ANALYZE delete from msgid;" the CPU is...
4
12715
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 our wider environment. Of course, development doesn't stop so I'm running some explain plans over some new views. The problem is, when the view is accessed as part of the explain plan script, the following error is returned.
0
1900
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
1803
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 it works. How is it that setting a property to null alters another property? For example setting optionObject.options = null; seems to set optionObject.selectedIndex to -1 automagically. Can you attach "hooks" in javascript that get called...
5
8095
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 HOLD LOCK OPEN WITH ALTER. I've created tables explain_* How can I start to find solution? Is it possible that my db2 doesn't support explain?
3
1460
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; p=ch; printf("Character is %c\n", *p);
0
2771
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. The statement itself is not that complicated, it is 3 selects and union all. Explain output is pretty big, but I could not find anything unusual. I'm new to db2 and I could be missing stuff. I am posting the explain output below and I really...
1
3573
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
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8739
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
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 we have to send another system

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.