Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Combine the text from multiple text boxes into one text box and inject html formatting

Exactly as the title states. Below is a failed example from that you should understand what I am trying to do.

txtBox3.text = txtBox1.text & <br></br> & txtBox2.text

How can I make this scenario work?
0
newimagent
Asked:
newimagent
  • 5
  • 4
1 Solution
 
Rajkumar GsSoftware EngineerCommented:
Please give this a try

txtBox3.text = txtBox1.text & "<br /><br />" & txtBox2.text

Raj
0
 
newimagentAuthor Commented:
That does not work. I've tried that as well.

I've also tried

Dim br As New HtmlGenericControl("br")
txtBox3.text = txtBox1.text & br & txtBox2.text

Anything in double quotes just shows up as text in the box and does not inject as html formatting.
0
 
newimagentAuthor Commented:
I managed to figure it out. Not sure if this is how you're supposed to do it but it works and the back and change view state functions are not giving me any kind of cross scripting error so i'll go with it.

Solution:

Dim br As New HtmlGenericControl(<br/>)

txtBox3 = txtBox1.Text & br.InnerHtml & txtBox2.Text
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
newimagentAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for newimagent's comment http:/Q_27398213.html#36972592

for the following reason:

Figured it out.
0
 
Rajkumar GsSoftware EngineerCommented:
Also if you enable TextMode="MultiLine" and use this code, it should work
txtBox3 = txtBox1.Text & vbCrLf  & txtBox2.Text

Raj
0
 
newimagentAuthor Commented:
Please give credit to RajkumaGS. His solution is much more lightweight and is a better fit.
0
 
newimagentAuthor Commented:
This works great. Thanks!
0
 
Rajkumar GsSoftware EngineerCommented:
Thanks newimagent.

You can now accept my solution.

raj
0
 
Rajkumar GsSoftware EngineerCommented:
Thanks for the points. and glad as I can help you :)
Raj
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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