Folder options missing in Windows XP


This problem occur in your windows mainly because of spyware or malware attack.

This kind of virus modified your system registry to prevent you from removing them.

Solution to fix this missing menu "Folder Options"

There is 2 method:

Method 1:

GROUP POLICY

-> run gpedit.msc
Go to:
user configration\administrator templates\windows
componant\windows explorer

-> remove the folder options at the right side window menu item from the tool menu (double click and disable it)

Method 2:

By editing the Registry

-> run regedit

HKEY_CURRENT_USER\software\microsoft\windows\current version\policies\explorer

-> find the nofolderoptions key and change the value to 0 assuming you have this key otherwise just create it and restart computer.



Hope this will help you.

Enable Task Manager

Error Message: "Task Manager has been disabled by your administrator"

Symptom

When you try to open Task Manager, the following error may occur:
Task Manager has been disabled by your administrator

Resolution

This error is caused if the DisableTaskMgr restriction is enabled. To enable Task Manager, try one of these methods:

Method 1

-> Click Start, Run and type this command exactly as given below: (better - Copy and paste)

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 0 /f

Method 2

-> Click Start, Run and type Regedit.exe
-> Navigate to the following branch:

HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies\ System

-> In the right-pane, delete the value named DisableTaskMgr
-> Close Regedit.exe

Method 3: Using Group Policy Editor - for Windows XP Professional

-> Click Start, Run, type gpedit.msc and click OK.
-> Navigate to this branch:

User Configuration / Administrative Templates / System / Ctrl+Alt+Delete Options / Remove Task Manager

-> Double-click the Remove Task Manager option.
-> Set the policy to Not Configured.

Hope this will help you.

Random Numbers

You can use Rnd and Randomize to generate random numbers. The Rnd Function uses the following syntax:

Rnd()

However, the Rnd Function returns a random number less than one. So, in order to get a whole number, you need to use the Int function. If you need a larger range than 0 or 1, you need to multiply the result.

The following code simulates a dice rolling:

Randomize
Dice1 = Int(5 * Rnd) + 1
Msgbox "You rolled a " & Dice1

the statement Int(5*rnd) generates a number from 0 to 5. You add one after as you cannot role a 0. The Int statement rounds up the number from the Rnd function, as the RND function returns a number less than 1. The Randomize statement initializes the Rnd function. Without this, each time you run your application you will get the same sequence of numbers.

To produce random integers in a given range, use this formula:

Int((upperbound - lowerbound + 1) * Rnd + lowerbound)

Here, upperbound is the highest number in the range, and lowerbound is the lowest number in the range.

Speeding the program

Have you ever tried to write a program where you've had to type something over and over? Well with this tutorial, you'll learn about speed saving things like modules, loops, and the with statement.
First off, I'll start with something REALLY easy but really time saving. It's called the with statement. Have you ever had to modify several properties of an object at once? If so, without the with statement you'd have a LOT of typing to do. Your code might look like this.

Text1.Text = "BlAh"
Text1.Font = "Arial"
Text1.Enabled = "True"
Text1.Height = 1000

Well, there is a way that makes it much faster. It's called the with statement. It saves you time by making it so you don't have to type the name of the object over and over again. You would use it like this.

With Text1
.Text = "BlAh"
.Font = "Arial"
.Enabled = "True"
.Height = 1000
End With

See the difference? A little extra code saves you from typing an object's name over and over. Make sure you remember the "End With". Also, it's a good idea to indent the property changes inside the with tags, since it's good to get into the habit of indenting.

The next thing that's really useful is loops. They allow you to repeat a process over and over, only typing it once. There are different types of loops. I'll tell keep it simple and tell you about the "Until" loop. Say you had a schedule and that gave you spaces to write down what you were supposed to be doing at five minute intervals. Let's say you want to exercise from 3:00 to 3:30. You wouldn't put "Exercise for 5 minutes" in every slot, would you? You'd probably put "Exercise until 3:30" at the 3:00 slot and leave the rest blank. That's like an "until" loop. Here's an example of an "Until" loop:

Do Until Text1.Text = "JoeJoeJoe"
Text1.Text = Text1.Text + "Joe"
Loop

That would make Text1.Text say "JoeJoeJoe" and you didn't have to type "Text1.Text = Text1.Text + "Joe"" 3 times. That's how an until loop works.

One thing that's very useful is modules. First, we need to create a module. Say you had a function, for example, changing a text box's font. If you wanted to use it several times, for different fonts, then you could use a module instead of typing it over and over again. Make a new project in Visual Basic, and add a text box, and a button. Go to the Project menu and select "Add Module". Select "Module" on the pop up window and hit Open. Now you'll see a coding window. Modules are like forms, but they don't have any form, they're just code. Modules allow you to write code that can be called by other forms, just like Public subs. Copy this code and paste it in your module. Now copy this code into your module.

Sub Changefont(FN As String)
Form1.Text1.Font = FN
End Sub

Notice the "FN As String" in brackets. This defines "FN" as a string, and that string will receive input from the form using the function when the function is used. But we'll get to that later. Also, notice how we put "Form1.Text1.Font" instead of just "Text1.Font". This is because the module is not a part of Form1, so we have to make it know which Form the textbox it's modifying is on. Now, go back to your form, and add this to "Private Sub Command1_Click"

Changefont (Tahoma)

Notice the "Tahoma" in brackets. That's the name of the font we're changing to. You can substitute any font for that, but I like Tahoma, so I used it. What this does is tells your "Changefont" function the variable FN is. For an exercise, try writing a function that changes a buttons caption.

Hopefully this tutorial will help you write programs more quickly, and save space.

Debugging your program

After creating your programs, it would be surprising if you had never had a bug in the code you've been writing. By now you should have written some original code for yourself, not just the examples supplied with the lessons. Whenever you write code there is the possibility of making mistakes. Heck! Even Professors make them, although very rarely. It can be very frustrating to try to find an error when you don't know where to begin to look. But there are techniques that can help.

Do you know where the term "bug", for a program error, comes from? In case you've never heard the story before, here it is, as told by Grace Hopper, one of the pioneers of programming.
In the late 40's even a simple computer was a big thing: 1000's of vacuum tubes and 1000's of square feet of floor space. A group of programmers were working late one hot summer night. To help to dissipate all the heat generated by those tubes, all the windows were open. At one point the program that they were working on bombed-out. Eventually they found the problem: a moth had flown in and had become lodged in the wiring, creating a short-circuit. Afterwards, every time a program would crash the programmer would exclaim, "There must be a bug in the machine!” To this day that has remained one of the mainstays of programmers: when the program goes wrong, blame the hardware!

One of the first techniques to master is the use of breakpoints. A breakpoint is a flag at a given point in code where program execution will be suspended to give you time to look at the content of variables or at the status of properties. When VB hits a breakpoint when running a program, the code window opens and an immediate window opens at the bottom of the screen. You can look at variables or properties in the immediate window and then, either do Start to resume execution or do Step, using to step through the execution, one statement at a time.

Again we will use the code from Lesson 5. In the code window, click the column to the left of a line of code. This will create a breakpoint indicated by a red dot (you remove the breakpoint by clicking on the red dot). When you run the program it will stop at the breakpoint. In the immediate window, look at the content of different variables or properties. Step through the code with ; the active statement is indicated by the yellow arrow. All the logic represented by IF or LOOP or DO statements will be executed according to the conditions present. If the yellow arrow jumps to a line that you don't expect, find the reason why.

Another technique to learn is called "error trapping". It consists in intercepting errors that can occur at execution rather than programming mistakes, although not providing for user errors can be considered a programming mistake.

Let's build a simple example. The user will input 2 numbers, a numerator and a denominator. The program will divide the numerator by the denominator and display the result. Easy so far. However, if the user inputs 0 for the denominator, the program crashes because programming cannot make sense of division by zero. So, we want to trap the error and process it before it displays an error message to the user. We will use the On Error GoTo ... statement. This tells the program that if there is some kind of run-time error, go to the error-processing-routine named. We have to create a line label to identify the error routine; a line label has a colon at the end, like error_rtn:, in the example. At the same time, there is an Err object created and it contains, among other things, a Number property that will identify the error. For example, if Err.Number = 11, the error was a division by zero; Err.Number = 6 represents an overflow situation.

It is worth noting that line labels in code do not end processing in any way. When the logic gets to a line label it keeps on going. The programmer has to make sure that the processing of errors in the error_rtn is not done automatically every cycle (that is called "falling through" the next routine and it's a common error).

Hide your files in a jpeg

1. Gather all the files that you wish to hide in a folder
anywhere in your PC (make it in C:\hidden - RECOMMENDED).

2. Now, add those files in a RAR archive (e.g. secret.rar).
This file should also be in the same directory (C:\hidden).

3. Now, look for a simple JPEG picture file (e.g. logo.jpg).
Copy/Paste that file also in C:\hidden.

4. Now, open Command Prompt (Go to Run and type ‘cmd‘).
Make your working directory C:\hidden.

5. Now type: “COPY /b logo.jpg + secret.rar output.jpg”
(without quotes). Now, logo.jpg is the picture you want to show,
secret.rar is the file to be hidden, and output.jpg is the file
which contains both. :D

6. Now, after you have done this, you will see a file output.jpg
in C:\hidden. Open it (double-click) and it will show the picture
you wanted to show. Now try opening the same file with WinRAR, it
will show the hidden archive.

Create folders with no name


1.Select any file or folder.

2.Right click on it, press rename or simply press F2.

3.Press and hold the alt key. While holding the Alt key,
type numbers 0160 from the numpad.

Note: Type the numbers 0160 from the numpad, that is,
the numbers present on the right side of the keyboard.
Don’t type the numbers which are present on top of the
character keys.

4.Press Enter and the nameless file or folder will be created.

Reason: The file or folder that seems nameless is actually
named with a single space.

But what if you want to create another nameless file or folder
in the same directory ?

For this you will have to rename the file with 2 spaces.
Just follow these steps below:

1.Select file, press F2.
2.Hold alt key and type 0160 from the numpad.
3.Release the alt key. Now without doing anything else,
again hold alt key and press 0160.
4.Press enter and you will have second nameless file in the
same directory.
5.Repeat step 3 to create as many nameless files or folders
in the same directory.

(we’ve had a problem with deleting these folders, to do so,
start your computer in safe mode and delete it from there.)

Understanding For, Do, and While Loops

Loops provide the ability to repeatedly execute the same block of code, and to each time change values such that each run through the loop produces different results. Visual Basic provides four main kinds of loops: the classic Do-Loop, the Do-Until Loop, the Do-While Loop, and the For-Next Loop.

Do-Loops

The most basic form of loop in Visual Basic is the Do-Loop. Its construct is very simple:

Do
(Code to execute)
Loop

This, quite simply, executes the block of code, and when it reaches Loop, returns to the beginning of the Do Loop and executes the same block of code again. The same block of code will be repeatedly executed until it is told to stop executing. So let's try to apply this to our problem of generating the Fibonacci series:

1. Dim X As Integer
2. Dim Y As Integer
3.
4. Do
5. Debug.Print X
6.
7. X = Y + X
8. Y = X - Y
9. Loop

And, believe it or not, this code works! Well, sort a. If you try to run this code, it will indeed generate the Fibonacci series; however, it will continually generate and print out the next number infinitely--or, in this case, until it reaches an overflow error. This is known as the problem of the infinite do-loop, one that all programmers will experience, and some quite frequently.

Exit Do

So we clearly need some way to escape from the Do-Loop. You could, of course, simply End the program once you have calculated enough values, but what if you still need to perform tasks after you're done calculating? The answer is to use the Exit Do statement. Whenever your program reaches an Exit Do statement within a loop, it will exit the current loop.

So, let's try a somewhat different approach to the Fibonacci problem. We decide that we want to calculate only eight values of the Fibonacci series, so we'll keep a counter and increment it each time throughout the loop. Then, once the counter reaches eight, we'll exit the loop.

1. Public Sub Main()
2. Dim X As Integer
3. Dim Y As Integer
4. Dim cnt As Integer 'Our counter.
5. cnt = 1
6. Do
7. Debug.Print X
8. X = Y + X
9. Y = X - Y
10.
11. If cnt >= 8 Then
12. Exit Do
13. Else
14. cnt = cnt + 1
15. End If
16. Loop
17. End Sub

And now we're talking! This program successfully computes and prints out the first eight values of the Fibonacci series.

Do Until

As an alternative approach to nesting an If-Statement inside the loop, and invoking Exit Do once we're done looping, Visual Basic provides a Do Until statement. Its syntax is the following:

Do Until (Expression)
(Code to execute)
Loop

(Expression) can be any legal logical expression that we wish to evaluate to determine whether or not to exit the loop. Each time the program reaches Loop it will evaluate this expression. If the expression is True, it will exit the loop for us, but otherwise it will continue looping.. So let's try rewriting our Fibonacci program to use a Do-Until loop instead of Exit Do.

1. Public Sub Main()
2. Dim X As Integer
3. Dim Y As Integer
4. Dim cnt As Integer 'Our counter.
5.
6. cnt = 1
7.
8. Do Until cnt >= 8
9. Debug.Print X
10.
11. X = Y + X
12. Y = X - Y
13. cnt = cnt + 1
14. Loop
15. End Sub

Here we've replaced the hideous If cnt >= 8 Then ... Else: Exit Do with a very simple Until cnt >= 8. We must, however, still be sure to increment our counter every time through the loop, or else the Until expression will never be True, resulting in an infinite Do Loop.

Do While

In the place of Do Until, you can also use Do While. Its syntax is the following:

Do While (Expression)
(Code to execute)
Loop

(Expression) can be any legal logical expression that we wish to evaluate to determine whether or not to exit the loop. Each time the program reaches Loop it will verify that this expression is True, and if it is False, it will exit the loop for us. Thus, instead of exiting when an expression is True, it now exits only once this expression is false. Let's try rewriting our Fibonacci program to use a Do-While loop instead of a Do-Until loop.

1. Public Sub Main()
2. Dim X As Integer
3. Dim Y As Integer
4. Dim cnt As Integer 'Our counter.
5.
6. cnt = 1
7. Do While cnt <>
8. Debug.Print X
9. X = Y + X
10. Y = X - Y
11.
12. cnt = cnt + 1
13. Loop
14. End Sub

For-Next Loops

In situations where you merely want to run the loop a predefined number of times, it can become quite tiresome to have to create and manage a counter for each loop, which is why we also have something called a For-Next Loop. This kind of loop allows you to specify a counter, to tell it to count from one number to another each time through the loop, and to exit once the counter has reached its upper limit. The syntax is as follow:

Dim I As Integer

For I = (Integer) To (Integer)
(Code to execute)
Next I

We used the variable name "I" above, as it is the most common name used for For-Loops; however, you can use any variable name you want, so long as the variable is of the type Integer. Now, let's improve our Fibonacci program even further:

1. Public Sub Main()
2. Dim X As Integer
3. Dim Y As Integer
4. Dim cnt As Integer 'Our counter.
5.
6. For cnt = 1 To 8
7. Debug.Print X
8. X = Y + X
9. Y = X - Y
10. Loop
11. End Sub

In the example above, we first dimensioned cnt as an Integer, and then, in the declaration of the For-Next loop, set its value to 1. Each time through the loop, the value of cnt was incremented by 1 until it reached 8, at which point the loop was executed.

Exit For

As with Do Loops, there is a statement that can be used to exit a For-Next loop, and it is called Exit For. Simply invoke this statement anywhere within a For-Next loop and the current loop will be exited.

Step

By default, the variable used in the declaration of the For-Next loop is incremented by 1 each time through the loop; however, if you want to increment this value by a different amount each time through the loop, you can simply append Step (Integer) to the end of the For-Next loop declaration. If, for instance, we wanted to print out every even number counting backward from 20 to 0, we could do this using the following code:

1. Dim I As Integer
2.
3. For I = 20 To 0 Step -2
4. Debug.Print I
5. Next I

So there you have it now you can use loops all over your Visual Basic 6 programs. These are one of the most useful tools you have. You might want to bookmark this tutorial so that later you can reference back to this great VB6 loop examples. If you have any questions or comments please post them below.

Formatting Numbers, Dates and Times

The Label control is still the easiest way of displaying the result of calculations. Whatever the answer is, just move it to Label5.Caption and it will appear on the form. Unfortunately, it does not always appear the way you want to see it. No problem if the result is a string but, what if it is a dollar amount or a date of some kind. That will require some formatting of the result before displaying it. We use the Format function:
Label5.Caption = Format(result, "formatting characters")

Numbers

For example, given that:

Dim result As Single
result = 3456.7
Label5.Caption = Format(result, "00000.00") 'displays: 03456.70
Label5.Caption = Format(result, "#####.##") 'displays: 3456.7
Label5.Caption = Format(result, "##,##0.00") 'displays: 3,456.70
Label5.Caption = Format(result, "$##,##0.00") 'displays: $3,456.70

Here is a list of what the formatting characters mean:

0
-> represents a digit, with non-significant leading and trailing zeros
#
-> represents a digit, without non-significant leading and trailing zeros
.
-> decimal placeholder
,
-> thousands separator
$ + - ( ) space
-> literal character; displayed as typed

When displaying dollar amounts, it is good practice to always use the 0 placeholder with the decimal so that 10 cents does not come out as $.1 or $0.1 Using the formatting string "$#0.00" ensures that the value follows standard rules and comes out as $0.10.

Dates and Times

When working with dates and times, you need to know that there is a function that will obtain the current date and time from the system clock. The function is: Now( ) and you can use it directly as in:
Label5.Caption = Now( )

The result is the current date and time formatted according to what you specified in the Windows Control Panel for your system. If you want to format the result, because you don't want to see the time, for example, there are formatting characters for date and time, as there are for numbers. The main characters are:

yy -> year without the century - eg: 00
yyyy -> year with century - eg: 2000
m -> month number - eg: 12
mmm -> short name of month - eg: dec
mmmm -> long name of month - eg: december
d -> day of the month, without zero - eg: 8
dd
-> day of the month, with zero - eg: 08
dddd
-> name of the day of the week - eg: Monday
h
-> hour, without zero - eg: 7
hh
-> hour, with zero - eg: 07
mm
-> minutes - eg: 45
ss
-> seconds - eg: 55

Thus, if Now( ) is July 8, 2000 ,
Label5.Caption = Format(Now( ), "dddd, yyyy mmmm dd")
returns: Saturday, 2000 July 08

Of course any other date can be formatted for display:
Label5.Caption = Format( DateOfBirth, "yyyy-mm-dd")

Named Formats

In addition to the formatting string, there are several named formats that can be used to determine the output format. These named formats are VB constants that you call when you need them:

General Number
-> Number with no thousands separator
Currency
-> Thousands separator, two digits to the right of decimal
Fixed
-> Displays at least one digit to the left and two digits to the right of decimal
Standard
-> Thousands separator, at least one digit to the left and two digits to the right of decimal
Percent
-> Multiplies by 100, add percent sign to the right
General Date
-> Display determined by Control panel settings; displays date and time
Long Date
-> Long date format specified for system
Short Date
-> Short date format specified for system
Long Time
-> Long time setting specified by system; includes hours, minutes, seconds
Short Time
-> Shows hours and minutes

Dim DateHired As Date
DateHired = "1995-10-25"
Label5.Caption = Format(DateHired, "Long Date")

returns: October 25, 1995

Manipulating text

Whenever you are entering data, creating files or databases, you are working with text strings. Text strings contain characters that can be copied, deleted, cut and reassembled but they also have important visual characteristics: size, color, weight, transparency, etc. In this lesson we will look at different ways of manipulating those text strings.

String functions

Here is a list of the basic functions that work with strings:

-Len(string): returns the length of string, the number of characters it contains.
-Left(string, number): returns the number of characters specified by number from the left end of string.
-Right(string, number): returns the number of characters specified by number from the right end of string.
-Mid(string, position, number): returns the number of characters specified by number starting at character number position from the left end of string.
-InStr(string1, string2): returns the position of string2 in string1 - returns 0 if string2 is not found in string1.
-LTrim(string), RTrim(string) and Trim(string): returns string with non-significant spaces removed from the left, the right or both, respectively.
-LCase(string), UCase(string): returns string converted to lower-case or upper-case, respectively.

Manipulating blocks of text

The TextBox and the ComboBox controls contain several properties which will allow you to manipulate blocks of text, in addition to single characters.

If you have to input a large quantity of text in a TextBox, for example, you do not want to see it all in a single line. There are 2 properties that you set that will make the data easier to see:

MultiLine = True allows you to have several lines of input, all separated by .
ScrollBars = 2 - Vertical will create scrollbars, useful to read text.

Then there are 3 properties to work with a block of selected text in the control:

SelStart an integer number identifying the start of selected text, the position of the first character in the block - starts at 0.
SelLength an integer number identifying the number of characters selected in the block.
SelText a string containing the selected text.

Note that this kind of manipulation is usually done with the mouse. However, you do not have to code for the mouse events. It is automatic - when you select text in a control, the appropriate events, MouseDown, MouseUp and MouseMove, are triggered by the control.

Here are the list of my programs


created in:



Simple Calculator

- a simple calculator with basic operations (add, subtract, multiply, divide).

Download


Temperature Converter
- convert Celsius to Fahrenheit and vice versa.

Download


Factorial
- calculates the factorial of an integer.

Download