Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

function in vb.net

Posted on 2008-09-29
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..
$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 63

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 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