Enhance UX by replacing manual input with dropdown for parameter names
- Replace txtParamName textbox with cboParamName dropdown combobox - Load parameter names from column C in [参数配置] worksheet - Implement automatic population of parameter dropdown during initialization - Set first parameter as default selection when data is available - Add proper validation and error handling for parameter data loading - Improve data integrity by preventing manual input errors This enhancement significantly improves user experience by eliminating manual typing and potential typos. Users can now select parameter names from a standardized list maintained in the configuration worksheet, ensuring consistency and reducing errors in the spec addition process. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,30 @@ Private Sub UserForm_Initialize()
|
|||||||
.ListStyle = fmListStyleOption
|
.ListStyle = fmListStyleOption
|
||||||
End With
|
End With
|
||||||
|
|
||||||
|
' 初始化参数名称下拉框 (新增)
|
||||||
|
With Me.cboParamName
|
||||||
|
.Clear
|
||||||
|
If Not mParamWorksheet Is Nothing Then
|
||||||
|
Dim paramLastRow As Long
|
||||||
|
Dim j As Long
|
||||||
|
Dim paramStr As String
|
||||||
|
|
||||||
|
' 表头在第2行,数据在C列,实际数据从第3行开始
|
||||||
|
paramLastRow = mParamWorksheet.Cells(mParamWorksheet.Rows.count, "C").End(xlUp).row
|
||||||
|
If paramLastRow >= 3 Then
|
||||||
|
For j = 3 To paramLastRow
|
||||||
|
paramStr = Trim(mParamWorksheet.Cells(j, 3).value)
|
||||||
|
If paramStr <> "" Then
|
||||||
|
.AddItem paramStr
|
||||||
|
End If
|
||||||
|
Next j
|
||||||
|
|
||||||
|
' 将数据中的第一个数据作为默认数据
|
||||||
|
If .ListCount > 0 Then .ListIndex = 0
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End With
|
||||||
|
|
||||||
' 初始化预览文本框
|
' 初始化预览文本框
|
||||||
On Error Resume Next
|
On Error Resume Next
|
||||||
Me.txtConditionPreview.Text = ""
|
Me.txtConditionPreview.Text = ""
|
||||||
@@ -228,7 +252,7 @@ End Sub
|
|||||||
Private Sub btnExecute_Click()
|
Private Sub btnExecute_Click()
|
||||||
' --- 校验输入 ---
|
' --- 校验输入 ---
|
||||||
Dim paramName As String, newValue As String, strategy As String
|
Dim paramName As String, newValue As String, strategy As String
|
||||||
paramName = Trim(Me.txtParamName.Text)
|
paramName = Trim(Me.cboParamName.Text)
|
||||||
newValue = Trim(Me.txtNewValue.Text)
|
newValue = Trim(Me.txtNewValue.Text)
|
||||||
strategy = Me.cboStrategy.value
|
strategy = Me.cboStrategy.value
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user