Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

convert VB.NET to C#

Hi,
  Please convert this VB.NET code to C#.  Please try to keep the second line of code a single line of code.

Dim questionID As Integer
questionID = CType(Items.FindControl("lblQnum"), Label).Text

Thanks, LLJ45
0
llj45
Asked:
llj45
  • 2
1 Solution
 
Rajkumar GsSoftware EngineerCommented:
int questionID = 0;
questionID = ((Label)Items.FindControl("lblQnum")).Text;

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

Raj
0
 
michael_madsenCommented:
Maybe something like this:

int questionID;
questionID = int.Parse(((Label)FindControl("lblQnum")).Text);
0
 
llj45Author Commented:
Hi, Raj
  I already tried the developerfusion converter web site.  It doesn't work on this code.
  You can set up an example to see what I mean.
Thanks, LLJ45
0
 
llj45Author Commented:
thanks!
0

Featured Post

Industry Leaders: 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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now