0

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

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
0

>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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.