Hi there,

I'm just wondering if anyone can help me with this. As stated in the title, I need to simplify my code. Here's my sample code:

textbox1.Text = name(1)
textbox2.Text = name(2)
textbox3.Text = name(3)
textbox4.Text = name(4)
textbox5.Text = name(5)

I'm thinking about making it like this...

Dim i As Short
For i = 1 To 5
     textbox(i).Text = name(i)
Next i

I know that the right side of the equation works but the left side doesn't work. Can this be simplified further so as to make my code a lot simpler. Thanks in advance.

OT: Also, how do you code this... For example, I have a String, let's say:

MICROSOFT

I want to color the "CRO" part with Red. How do you code that? The output should be:

MICROSOFT

Again, thanks in advance :D

>Can this be simplified further so as to make my code a lot simpler.

Dim txtBox() As TextBox = {TextBox1, TextBox2, TextBox3, TextBox4}

For i As Integer = 0 To Name.Length - 1
  txtBox(i).Text = Name(i)
Next

>I want to color the "CRO" part with Red.
Think about GDI+ basic graphics functionality.

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.