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 ''' ''' ÀÌ °³Ã¼¿¡ Ä¿¼­¸¦ À̵¿ÇÕ´Ï´Ù. ''' ''' 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 ''' ''' Á¤·Ä SQL¹®¹ýÀ» ¹ÝȯÇÕ´Ï´Ù.(PROMPT=TRUE À̸é ORDER BY °¡ ºÙ¿©¼­ ¹ÝȯµË´Ï´Ù.) ''' ''' ''' 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 ''' ''' ÅǼø¼­·Î Á¤·ÄµÇ¾îÀÖ´Â ¾ÆÀÌÅÛÀ» ¹ÝȯÇÕ´Ï´Ù ''' ''' ''' 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