using if,else inside a string

It is containing all topics related to Visual Basic, .NET Framework, Web Resource, GDI etc.
ramverma
Posts: 435
Joined: Sat Aug 23, 2014 5:34 pm
Contact:

using if,else inside a string

Postby ramverma » Tue Oct 13, 2015 7:18 am

hi,
I'm trying to arrange a string with conditional sections which seems to be incorrect. Just looking for the right way.

var string = "";
var int = 2;
string ="the var int mentioned here" + if(int == 2){"equals 2"}else{"doesn't equal 2"}

any idea to do it the right way without having to right the whole string again for each situation?

thanks...


Return to “Visual Basic .NET and ASP.NET”

Who is online

Users browsing this forum: No registered users and 2 guests