Solved

VB.net C# simple for Next loop

Posted on 2012-03-20
2
322 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
[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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
parse string in c# 5 41
How we can add Dten600.dll in GAC in c#. 18 55
Make borderless form movable by user 2 27
How does this modal work? 3 34
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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