Solved

VB.net C# simple for Next loop

Posted on 2012-03-20
2
314 Views
Last Modified: 2012-03-20
Hi

Is there a more simple way to do the following For Next Loop in C#

public void A()
{
      int i = 0;
      for (i = 1; i <= 10; i++) {
            Interaction.MsgBox(Convert.ToString(i));
      }
}

I got this from converting the following VB.net code which looks far more simple

    Sub A()
        Dim i As Integer
        For i = 1 To 10
            MsgBox(CStr(i))
        Next i
    End Sub
0
Comment
Question by:murbro
2 Comments
 
LVL 4

Accepted Solution

by:
jatkin earned 500 total points
ID: 37741988
Hi,

Depends exactly what you are after...

You could use

for (int i = 1; i <= 10; i++) MessageBox.Show(i.ToString());
0
 

Author Closing Comment

by:murbro
ID: 37742043
Thanks very much
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 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