function in

Posted on 2008-09-29
Last Modified: 2010-04-23
hello there,
Im trying to convert this little peace of code to can someone help me out please..

$checkthisnumber = 100;


while ($i < 151) 



 if ($i == $checkthisnumber) 


                echo "number found,: ". $checkthisnumber;


        } else {

                echo $i." was not found";






Open in new window

Question by:XK8ER
LVL 59

Accepted Solution

Kevin Cross earned 500 total points
ID: 22602550
You could do this in a VB.NET sub like this:
'CheckNumber(100) <--- $checkthisnumber = 100;

Sub CheckNumber(ByVal number As Integer)

     Dim i As Integer = 1 '$i=1;

     While i < 151 'while ($i < 151) 

         If i = number Then 'if ($i == $checkthisnumber) 

             'echo "number found,: ". $checkthisnumber;

             Response.Write("number found,: " & CStr(number))


             'echo $i." was not found";

             Response.Write(CStr(number) & " was not found")


         i = i + 1 '$i++;

     End While

End Sub

Open in new window

LVL 62

Expert Comment

by:Fernando Soto
ID: 22602579

This snippet should do the same thing.


Dim checkthisnumber As Integer = 100

Dim i As Integer = 1

While i < 151

    If i = checkthisnumber Then

        Console.WriteLine("number found,: " & checkthisnumber.ToString())


        Console.WriteLine(i.ToString() & " was not found")

    End If

    i += 1

End While

Open in new window


Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
spacing 5 27
Closing all open child forms. 4 23
writting html or javascript in PHP 8 10
Getfiles in 21 12
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

707 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

16 Experts available now in Live!

Get 1:1 Help Now