I use a Form to gather Input from the user, and my program needs to format the info and show it in a Text Box. Everything works except 2 of my variables need to look like this in the output: "variable".

The problem is that I can't find a way to make the variable write with quotations around it. Is there a simple solution to my issue, or am I going to have to find a way around using quotations?

Recommended Answers

All 4 Replies

Try something like this: textBox1.Text = "\"varia\"";

When I tried that it just printed this: "variable".
Is there anyway I can get it to print a string where the word 'variable' is?

textBox1.Text = "\"" + myStringVariable + "\"";

textBox1.Text = String.Format("\"{0}\"", someVariable);

char quote = '"';
textBox1.Text = quote + myStringVariable + quote;

Thanks Momerath, that was exactly what I was looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.