Positionsanpassung update/insert
This commit is contained in:
@@ -4,67 +4,71 @@ Imports System.Text.RegularExpressions
|
||||
Public Class ClassControlValues
|
||||
|
||||
Public Shared Function ControlHasValue(control As Control) As Boolean
|
||||
Try
|
||||
Select Case control.GetType()
|
||||
Case GetType(TextBox)
|
||||
Dim textbox As TextBox = DirectCast(control, TextBox)
|
||||
If textbox.Text.Trim() = String.Empty Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Select Case control.GetType()
|
||||
Case GetType(TextBox)
|
||||
Dim textbox As TextBox = DirectCast(control, TextBox)
|
||||
If textbox.Text.Trim() = String.Empty Then
|
||||
Return False
|
||||
Else
|
||||
Case GetType(CustomComboBox)
|
||||
Dim combobox As CustomComboBox = DirectCast(control, CustomComboBox)
|
||||
If combobox.Text.Trim() = String.Empty Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(CheckBox)
|
||||
Dim checkbox As CheckBox = DirectCast(control, CheckBox)
|
||||
Return checkbox.Checked
|
||||
|
||||
Case GetType(RadioButton)
|
||||
Dim radiobutton As RadioButton = DirectCast(control, RadioButton)
|
||||
Return radiobutton.Checked
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.DateEdit)
|
||||
Dim datepicker As DevExpress.XtraEditors.DateEdit = DirectCast(control, DevExpress.XtraEditors.DateEdit)
|
||||
If IsDBNull(datepicker.EditValue) Or datepicker.EditValue = DateTime.MinValue Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.ListBoxControl)
|
||||
Dim listbox As DevExpress.XtraEditors.ListBoxControl = DirectCast(control, DevExpress.XtraEditors.ListBoxControl)
|
||||
If listbox.SelectedIndex = -1 Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
Dim checkedlistbox = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
If checkedlistbox.CheckedItemsCount = 0 Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(PictureBox)
|
||||
Dim picturebox = DirectCast(control, PictureBox)
|
||||
If IsNothing(picturebox.BackgroundImage) Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case Else
|
||||
Return True
|
||||
End If
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
|
||||
Case GetType(CustomComboBox)
|
||||
Dim combobox As CustomComboBox = DirectCast(control, CustomComboBox)
|
||||
If combobox.Text.Trim() = String.Empty Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(CheckBox)
|
||||
Dim checkbox As CheckBox = DirectCast(control, CheckBox)
|
||||
Return checkbox.Checked
|
||||
|
||||
Case GetType(RadioButton)
|
||||
Dim radiobutton As RadioButton = DirectCast(control, RadioButton)
|
||||
Return radiobutton.Checked
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.DateEdit)
|
||||
Dim datepicker As DevExpress.XtraEditors.DateEdit = DirectCast(control, DevExpress.XtraEditors.DateEdit)
|
||||
If IsDBNull(datepicker.EditValue) Or datepicker.EditValue = DateTime.MinValue Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.ListBoxControl)
|
||||
Dim listbox As DevExpress.XtraEditors.ListBoxControl = DirectCast(control, DevExpress.XtraEditors.ListBoxControl)
|
||||
If listbox.SelectedIndex = -1 Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
Dim checkedlistbox = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
If checkedlistbox.CheckedItemsCount = 0 Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case GetType(PictureBox)
|
||||
Dim picturebox = DirectCast(control, PictureBox)
|
||||
If IsNothing(picturebox.BackgroundImage) Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
|
||||
Case Else
|
||||
Return True
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user