convert c# to vb.net

664 views Asked by At

can anyone pls help me convert this to vb.net

for each (DictionaryEntry<String, Int64> entry in characterCounter)
{
  textBox1.Text += String.Format("char {0} occurs {1} times", entry.Key, entry.Value);
}

most of the free/online converter throw errors

4

There are 4 answers

0
Smith On BEST ANSWER
For Each entry As KeyValuePair(Of [String], Int64) In characterCounter
                txtSummary.Text += String.Format("char {0} occurs {1} times", entry.Key, entry.Value)
    Next
4
Darin Dimitrov On

Try here: http://www.developerfusion.com/tools/convert/csharp-to-vb/

Of course this site assumes that you have valid C# code which is not your case. There is not such operator for each in C#. Also the DictionaryEntry class is not generic. Here's the automatic translation:

For Each entry As DictionaryEntry In characterCounter
    textBox1.Text += [String].Format("char {0} occurs {1} times", entry.Key, entry.Value)
Next
3
Jon On
For Each entry As DictionaryEntry In characterCounter
    textBox1.Text += String.Format("char {0} occurs {1} times", entry.Key, entry.Value)
Next
0
hirendra On
For Each entry As DictionaryEntry In characterCounter
    textBox1.Text += String.Format("char {0} occurs {1} times", entry.Key, entry.Value)
Next

You can also try this online tool for converting c# to vb.net here: C# to VB