I need to pass a variable by name like this
Dim html_news = "...the news ..."
Dim var = "news"
Dim a = "html_" & var
' content of that variable
How can I do that in VB.NET ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
vb.net doesn’t really lend itself to what you need to do – you could have done that sort of thing in scripting languages like classic asp and JavaScript. Although it might not have been the ‘right’ way to do it – the use of the ‘eval’ function is frowned on in Javscript as it’s a security risk. I think the code below will do what you need in a way that’s more in keeping with the way that vb.net works –