Hi,
I would like to ask something which is still eluding my understanding
Say I have a button, when this button is click the following is happen:
So basically when a certain condition arise (TextBox1. Text = Test) then series of actions happen for a textbox and that actions is repeated for some other textboxes as well.
I could have many texboxes with many actions so the code can get very long. So how to optimize this?
So in my mind something like this needs to happen:
And then:
It is obviously not correct
.
How can this be achieved?
Thanks
I would like to ask something which is still eluding my understanding
Say I have a button, when this button is click the following is happen:
Code:
If TextBox1. Text = Test Then
Textbox2.Text = Completed
TextBox2.BackColour = Colour.Green
TextBox2.ForeColour = Color.Yellow
TextBox2.Enabled = True
Textbox3.Text = Completed
TextBox3.BackColour = Colour.Green
TextBox3.ForeColour = Color.Yellow
TextBox3.Enabled = True
Textbox4.Text = Completed
TextBox4.BackColour = Colour.Green
TextBox4.ForeColour = Color.Yellow
TextBox4.Enabled = True
Textbox5.Text = Completed
TextBox5.BackColour = Colour.Green
TextBox5.ForeColour = Color.Yellow
TextBox5.Enabled = True
End If
I could have many texboxes with many actions so the code can get very long. So how to optimize this?
So in my mind something like this needs to happen:
Code:
Dim myTextBoxes as Textbox = Textbox2 + Textbox3 + Textbox4 + Textbox5
Code:
If TextBox1. Text = Test Then
MyTextBoxes.Text = Completed
MyTextBoxes.BackColour = Colour.Green
MyTextBoxes.ForeColour = Color.Yellow
MyTextBoxes.Enabled = True
How can this be achieved?
Thanks