Solved

function in vb.net

Posted on 2008-09-29
2
194 Views
Last Modified: 2010-04-23
hello there,
Im trying to convert this little peace of code to vb.net can someone help me out please..
thanks
<?PHP

$checkthisnumber = 100;

$i=1;

while ($i < 151) 

{

        

 if ($i == $checkthisnumber) 

        {

                echo "number found,: ". $checkthisnumber;

		break;

        } else {

                echo $i." was not found";

        }

$i++;

}

 

?>

Open in new window

0
Comment
Question by:XK8ER
2 Comments
 
LVL 59

Accepted Solution

by:
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))

         Else 

             'echo $i." was not found";

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

         End
 

         i = i + 1 '$i++;

     End While

End Sub

Open in new window

0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 22602579
Hi XK8ER;

This snippet should do the same thing.

Fernando

Dim checkthisnumber As Integer = 100

Dim i As Integer = 1
 

While i < 151

    If i = checkthisnumber Then

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

    Else

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

    End If

    i += 1

End While

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WordPress syntax 2 27
highcharts wont fix inside a bootstrap modal window 6 30
Variable Event ? 3 23
php construct 5 7
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

896 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

17 Experts available now in Live!

Get 1:1 Help Now