Solved

function in vb.net

Posted on 2008-09-29
2
198 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
[X]
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
2 Comments
 
LVL 60

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 63

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to make search between pages 17 60
How can I stuff the results of this for loop into an array? 3 42
Code not executing correctly. 3 44
Datatable / Dates ? 4 33
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article discusses four methods for overlaying images in a container on a web page
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…

752 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