121 lines
4.3 KiB
VB.net
121 lines
4.3 KiB
VB.net
Imports System.Text
|
|
Imports System.IO
|
|
|
|
Public Class MySortGrp
|
|
Public Sub SAVE_Setting()
|
|
Dim a As New MyINI2(My.Application.Info.DirectoryPath & "\Setting.INI")
|
|
For Each C As Control In Me.Controls
|
|
If C.GetType.Name.ToUpper = "CHECKBOX" Then
|
|
a.Write(Me.Parent.Name & "-" & Me.Name, C.Name, CType(C, MyControlOLEDBv2.MyCheckBox).CheckState.ToString)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Public Sub LOAD_Setting()
|
|
Dim FILEname As String = My.Application.Info.DirectoryPath & "\Setting.INI"
|
|
Dim a As New MyINI2(FILEname)
|
|
If Not File.Exists(FILEname) Then
|
|
MsgBox("열너비 파일이 존재하지 않습니다", MsgBoxStyle.Critical, "열너비설정-오류")
|
|
SAVE_Setting()
|
|
Return
|
|
End If
|
|
'MsgBox("PARENT" & Me.Parent.Name.ToString & "/" & Me.Parent.Text)
|
|
Dim Getdata As String
|
|
For Each C As Control In Me.Controls
|
|
If C.GetType.Name.ToUpper = "CHECKBOX" Then
|
|
Try
|
|
Getdata = a.Read(Me.Parent.Name & "-" & Me.Name, C.Name)
|
|
Select Case Getdata.ToUpper
|
|
Case "UNCHECKED"
|
|
CType(C, MyControlOLEDBv2.MyCheckBox).CheckState = CheckState.Unchecked
|
|
Case "INDETERMINATE"
|
|
CType(C, MyControlOLEDBv2.MyCheckBox).CheckState = CheckState.Indeterminate
|
|
Case "CHECKED"
|
|
CType(C, MyControlOLEDBv2.MyCheckBox).CheckState = CheckState.Checked
|
|
End Select
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
|
|
''' <summary>
|
|
''' 이 개체에 커서를 이동합니다.
|
|
''' </summary>
|
|
''' <remarks></remarks>
|
|
Public Sub DB_SetFocus()
|
|
'정렬된 아이템중에 1번쨰 아이템에 포커르를 줍니다.
|
|
Dim A As ArrayList = GetSortedItem()
|
|
Dim itm As Control = A(0)
|
|
Dim ItmType As String = itm.GetType.Name.ToString.ToUpper
|
|
Select Case ItmType
|
|
Case "TEXTBOX"
|
|
CType(itm, MyControlOLEDBv2.MyTextBox).Focus()
|
|
Case "CHECKBOX"
|
|
CType(itm, MyControlOLEDBv2.MyCheckBox).Focus()
|
|
Case "COMBOBOX"
|
|
CType(itm, MyControlOLEDBv2.MyCombo).Focus()
|
|
End Select
|
|
|
|
|
|
End Sub
|
|
|
|
''' <summary>
|
|
''' 정렬 SQL문법을 반환합니다.(PROMPT=TRUE 이면 ORDER BY 가 붙여서 반환됩니다.)
|
|
''' </summary>
|
|
''' <returns></returns>
|
|
''' <remarks></remarks>
|
|
Public Function GetSort(Optional ByVal HEADER As Boolean = False) As String
|
|
Dim SQL As New StringBuilder()
|
|
Dim First As Boolean = False
|
|
Dim Ar As ArrayList = GetSortedItem()
|
|
|
|
For Each ITM As MyControlOLEDBv2.MyCheckBox In Ar
|
|
' MsgBox(ITM.DB_ColName)
|
|
If ITM.Value <> Nothing Then
|
|
If Not First Then
|
|
First = True
|
|
SQL.Append(Space(1) & CType(ITM, MyControlOLEDBv2.MyCheckBox).DB_ColName & Space(1) & CType(ITM, MyControlOLEDBv2.MyCheckBox).Value)
|
|
Else
|
|
SQL.Append(Space(1) & "," & CType(ITM, MyControlOLEDBv2.MyCheckBox).DB_ColName & Space(1) & CType(ITM, MyControlOLEDBv2.MyCheckBox).Value)
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
If SQL.ToString.Trim = "" Then
|
|
Return vbNullString
|
|
Else
|
|
Return IIf(HEADER, " ORDER BY " & SQL.ToString, SQL.ToString)
|
|
End If
|
|
End Function
|
|
|
|
''' <summary>
|
|
''' 탭순서로 정렬되어있는 아이템을 반환합니다
|
|
''' </summary>
|
|
''' <returns></returns>
|
|
''' <remarks></remarks>
|
|
Private Function GetSortedItem() As ArrayList
|
|
Dim Iname As String
|
|
Dim CAr As New ArrayList
|
|
Dim CArC As New ArrayList
|
|
|
|
For Each itm As Control In Me.Controls
|
|
Iname = itm.GetType.Name.ToString.ToUpper
|
|
If Iname = "CHECKBOX" Then
|
|
CAr.Add(itm.TabIndex)
|
|
End If
|
|
Next
|
|
CAr.Sort()
|
|
|
|
For i As Integer = 0 To CAr.Count - 1
|
|
For Each itm As Control In Me.Controls
|
|
Iname = itm.GetType.Name.ToString.ToUpper
|
|
If itm.TabIndex = CAr.Item(i) Then CArC.Add(itm)
|
|
Next
|
|
Next
|
|
Return CArC
|
|
End Function
|
|
End Class
|