本文介绍了比较多个文本框中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
如何将panel6中所有可见文本框的值与textbox1中的值进行比较?
谢谢
我尝试过:
我尝试了这个编辑过的代码,但在这部分没有任何反应。
Hello,
How can I compare value from all visible textboxes in panel6 with value in textbox1?
thank you
What I have tried:
I tried this edited code but in this part nothing happen.
If ctl.Text = TextBox1.Text Then
ctl.BackColor = Color.LimeGreen
Dim EmptyTextBoxFound As Boolean = False 'Boolean flag for empty textbox
Dim EmptyTextBoxName As String = ""
For Each ctl As Control In Panel6.Controls
If TypeOf ctl Is TextBox AndAlso ctl.Visible AndAlso ctl.Text.Length > 6 Then
EmptyTextBoxName = ctl.Name
EmptyTextBoxFound = True
Exit For
If EmptyTextBoxFound = True Then
If ctl.Text = TextBox1.Text Then
ctl.BackColor = Color.LimeGreen
Else
ctl.Select()
ctl.BackColor = Color.LightSalmon
End If
End If
End If
Next
推荐答案
Dim EmptyTextBoxFound As Boolean = False 'Boolean flag for empty textbox
Dim EmptyTextBoxName As String = ""
For Each ctl As Control In Panel6.Controls
If TypeOf ctl Is TextBox AndAlso ctl.Visible AndAlso ctl.Text.Length > 6 Then
EmptyTextBoxName = ctl.Name
EmptyTextBoxFound = True
Exit For '<<<<<<<<<<<<<<<<<<<< THIS LINE HERE JUMPS EXECUTION TO . . .
If EmptyTextBoxFound = True Then V
If ctl.Text = TextBox1.Text Then |
ctl.BackColor = Color.LimeGreen |
Else |
ctl.Select() |
ctl.BackColor = Color.LightSalmon |
End If |
|
End If |
End If V
Next
'<<<<<<<<<<<<<<<<<<< THIS LINE HERE
这篇关于比较多个文本框中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!