-2
literal.Text = (gridView.Controls[i] as CheckBox).Checked ? "True" : "False";

How to convert this line to VB.Net syntax, could someone please help me?

Mark Hall
  • 52,990
  • 9
  • 92
  • 107
maufonfa
  • 92
  • 8
  • 2
    duplicate of http://stackoverflow.com/questions/576431/is-there-a-conditional-ternary-operator-in-vb-net – hatchet - done with SOverflow Jan 19 '12 at 14:53
  • You'd best learn to program. In this case the following happens: An element from an array is casted to a checkbox, then the Checked property is converted to a String in a rather cumbersome way. – TJHeuvel Jan 19 '12 at 14:55
  • 1
    *Too localized*? This is an exact duplicate, not too localized. He's asking how to convert that in general, which would help other people in the future if it weren't a duplicate. – Devin Burke Jan 19 '12 at 14:57
  • How can this be duplicate? Read the question and then comment – maufonfa Jan 19 '12 at 15:30
  • I know how to program in VB.Net no in C# so please don't mess with people knowledge. u r no god TJHeuvel – maufonfa Jan 19 '12 at 15:31

4 Answers4

1
 literal.Text = If(TryCast(gridView.Controls(i), CheckBox).Checked, "True", "False")

You can always use this nice online converter

Emmanuel N
  • 7,202
  • 2
  • 25
  • 36
0

Cheat. Use a code converter. There are free ones online. Learn from what you get for results.

http://converter.telerik.com/

produces

literal.Text = If(TryCast(gridView.Controls(i), CheckBox).Checked, "True", "False")
David
  • 70,778
  • 16
  • 128
  • 169
0

there are online converters you can use to get pretty close for this stuff

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

literal.Text = If(TryCast(gridView.Controls(i), CheckBox).Checked, "True", "False")
Brian
  • 2,164
  • 16
  • 23
0
literal.Text = If(TryCast(gridView.Controls(i), CheckBox).Checked, "True", "False")
shenhengbin
  • 4,174
  • 1
  • 22
  • 33