diff --git a/app/DD-Record-Organiser/ClassControlLoader.vb b/app/DD-Record-Organiser/ClassControlLoader.vb
index 9f8bea1..f32f544 100644
--- a/app/DD-Record-Organiser/ClassControlLoader.vb
+++ b/app/DD-Record-Organiser/ClassControlLoader.vb
@@ -11,6 +11,26 @@
Return sqlCommand
End Function
+ Public Shared Function LoadAutoValue(control As Windows.Forms.Control, RecordId As Integer, ParentRecordId As Integer)
+ Dim AutoValue As String = String.Empty
+ Dim ControlId As Integer = control.Tag
+ Dim SQL As String = ClassDatabase.Execute_Scalar(String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = {0}", ControlId))
+ SQL = ClassControlValues.ReplaceSqlCommandPlaceholders(SQL, RecordId, ParentRecordId)
+
+ If SQL = "" Or IsDBNull(SQL) Then
+ Return Nothing
+ End If
+
+ AutoValue = ClassDatabase.Execute_Scalar(SQL)
+
+ If String.IsNullOrEmpty(AutoValue) Or IsDBNull(AutoValue) Then
+ Return Nothing
+ End If
+
+ Return AutoValue
+
+ End Function
+
End Class
Public Class _ListControl : Inherits _BaseControl
@@ -150,33 +170,14 @@
Public Class Label : Inherits _BaseControl
- Private Shared Function LoadAutoValue(control As Windows.Forms.Control, RecordId As Integer, ParentRecordId As Integer)
- Dim AutoValue As String = String.Empty
- Dim ControlId As Integer = control.Tag
- Dim SQL As String = ClassDatabase.Execute_Scalar(String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = {0}", ControlId))
- SQL = ClassControlValues.ReplaceSqlCommandPlaceholders(SQL, RecordId, ParentRecordId)
-
- If SQL = "" Or IsDBNull(SQL) Then
- Return control.Text
- End If
-
- AutoValue = ClassDatabase.Execute_Scalar(SQL)
-
- If String.IsNullOrEmpty(AutoValue) Or IsDBNull(AutoValue) Then
- SQL = String.Format("SELECT CONTROL_TEXT FROM TBPMO_CONTROL_SCREEN WHERE CONTROL_ID = {0}", ControlId)
- Dim value = ClassDatabase.Execute_Scalar(SQL)
- Return value
- Else
- Return AutoValue
- End If
-
- End Function
-
Public Shared Sub LoadValue(control As Windows.Forms.Label, recordId As Integer, parentRecordId As Integer, value As String)
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
If IsNothing(autoValue) Then
- control.Text = value
+ Dim ControlId As Integer = control.Tag
+ Dim SQL = String.Format("SELECT CONTROL_TEXT FROM TBPMO_CONTROL_SCREEN WHERE CONTROL_ID = {0}", ControlId)
+ Dim labelText As String = ClassDatabase.Execute_Scalar(SQL)
+ control.Text = labelText
Else
control.Text = autoValue
End If
@@ -206,8 +207,14 @@
Public Class TextBox : Inherits _BaseControl
- Public Shared Sub LoadValue(control As Windows.Forms.TextBox, value As String)
- control.Text = value
+ Public Shared Sub LoadValue(control As Windows.Forms.TextBox, recordId As Integer, parentRecordId As Integer, value As String)
+ Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
+
+ If IsNothing(autoValue) Then
+ control.Text = value
+ Else
+ control.Text = autoValue
+ End If
End Sub
End Class
diff --git a/app/DD-Record-Organiser/ClassControlValues.vb b/app/DD-Record-Organiser/ClassControlValues.vb
index 4cea6b0..55aed85 100644
--- a/app/DD-Record-Organiser/ClassControlValues.vb
+++ b/app/DD-Record-Organiser/ClassControlValues.vb
@@ -44,7 +44,7 @@ Public Class ClassControlValues
Select Case control.GetType()
Case GetType(TextBox)
Dim textbox As TextBox = DirectCast(control, TextBox)
- ControlLoader.TextBox.LoadValue(textbox, value)
+ ControlLoader.TextBox.LoadValue(textbox, recordId, parentRecordId, value)
Case GetType(Label)
Dim label As Label = DirectCast(control, Label)
diff --git a/app/DD-Record-Organiser/frmForm_Constructor_Main_2.resx b/app/DD-Record-Organiser/frmForm_Constructor_Main_2.resx
index 57936f7..028617a 100644
--- a/app/DD-Record-Organiser/frmForm_Constructor_Main_2.resx
+++ b/app/DD-Record-Organiser/frmForm_Constructor_Main_2.resx
@@ -304,6 +304,6 @@
1222, 54
- 242
+ 150
\ No newline at end of file