Public Class ActualizarLimiteCredito
    Inherits System.Windows.Forms.Form
    Private sentLimiteCredito As New sentLimiteCredito.LimiteCredito
    Private dtDetalle As DataTable
    Private i As Integer
    Private condiciones As String
    Private condicion As String
    Private condicion1 As String
    Private observacion As String
    Private importes As Decimal
    Private modo As Integer
    Private canDecimales As Integer

    Private Color1, Color2 As String

#Region " Código generado por el Diseñador de Windows Forms "

    Public Sub New()
        MyBase.New()

        'El Diseñador de Windows Forms requiere esta llamada.
        InitializeComponent()

        'Agregar cualquier inicialización después de la llamada a InitializeComponent()

    End Sub

    'Form reemplaza a Dispose para limpiar la lista de componentes.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Requerido por el Diseñador de Windows Forms
    Private components As System.ComponentModel.IContainer

    'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
    'Puede modificarse utilizando el Diseñador de Windows Forms. 
    'No lo modifique con el editor de código.
    Friend WithEvents BottomRightColor As LaMarvin.Windows.Forms.ColorPicker
    Friend WithEvents TopLeftColor As LaMarvin.Windows.Forms.ColorPicker
    Friend WithEvents Tool1 As System.Windows.Forms.ToolTip
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents FlatRadioButton1 As vbWindowsUI.FlatRadioButton
    Friend WithEvents FlatRadioButton2 As vbWindowsUI.FlatRadioButton
    Friend WithEvents TxtMoneda1 As TxtMoneda.TxtMoneda
    Friend WithEvents TxtMoneda2 As TxtMoneda.TxtMoneda
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents Label12 As System.Windows.Forms.Label
    Friend WithEvents Label13 As System.Windows.Forms.Label
    Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents cmdDetalle As System.Windows.Forms.Button
    Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents dgDetalle As System.Windows.Forms.DataGrid
    Friend WithEvents cmdLimpiar As System.Windows.Forms.Button
    Friend WithEvents cmdProceso As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(ActualizarLimiteCredito))
        Me.BottomRightColor = New LaMarvin.Windows.Forms.ColorPicker
        Me.TopLeftColor = New LaMarvin.Windows.Forms.ColorPicker
        Me.Tool1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.Label15 = New System.Windows.Forms.Label
        Me.Label14 = New System.Windows.Forms.Label
        Me.Label13 = New System.Windows.Forms.Label
        Me.Label12 = New System.Windows.Forms.Label
        Me.Label11 = New System.Windows.Forms.Label
        Me.Label10 = New System.Windows.Forms.Label
        Me.Label9 = New System.Windows.Forms.Label
        Me.Label8 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.TxtMoneda2 = New TxtMoneda.TxtMoneda(Me.components)
        Me.TxtMoneda1 = New TxtMoneda.TxtMoneda(Me.components)
        Me.FlatRadioButton2 = New vbWindowsUI.FlatRadioButton
        Me.FlatRadioButton1 = New vbWindowsUI.FlatRadioButton
        Me.TextBox6 = New System.Windows.Forms.TextBox
        Me.Label7 = New System.Windows.Forms.Label
        Me.TextBox5 = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.TextBox4 = New System.Windows.Forms.TextBox
        Me.Label5 = New System.Windows.Forms.Label
        Me.TextBox3 = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.TextBox2 = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.cmdDetalle = New System.Windows.Forms.Button
        Me.dgDetalle = New System.Windows.Forms.DataGrid
        Me.cmdLimpiar = New System.Windows.Forms.Button
        Me.cmdProceso = New System.Windows.Forms.Button
        CType(Me.dgDetalle, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'BottomRightColor
        '
        Me.BottomRightColor.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.BottomRightColor.Color = System.Drawing.SystemColors.Control
        Me.BottomRightColor.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(238, Byte))
        Me.BottomRightColor.ForeColor = System.Drawing.Color.Cyan
        Me.BottomRightColor.Location = New System.Drawing.Point(733, 283)
        Me.BottomRightColor.Name = "BottomRightColor"
        Me.BottomRightColor.Size = New System.Drawing.Size(12, 12)
        Me.BottomRightColor.TabIndex = 3
        Me.BottomRightColor.Text = "ColorPicker1"
        Me.BottomRightColor.TextDisplayed = False
        '
        'TopLeftColor
        '
        Me.TopLeftColor.Color = System.Drawing.SystemColors.Control
        Me.TopLeftColor.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(238, Byte))
        Me.TopLeftColor.ForeColor = System.Drawing.Color.Cyan
        Me.TopLeftColor.Location = New System.Drawing.Point(0, 0)
        Me.TopLeftColor.Name = "TopLeftColor"
        Me.TopLeftColor.Size = New System.Drawing.Size(12, 12)
        Me.TopLeftColor.TabIndex = 4
        Me.TopLeftColor.Text = "ColorPicker1"
        Me.TopLeftColor.TextDisplayed = False
        '
        'Label15
        '
        Me.Label15.BackColor = System.Drawing.Color.Transparent
        Me.Label15.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label15.Location = New System.Drawing.Point(-8, 208)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(176, 24)
        Me.Label15.TabIndex = 15
        Me.Label15.Text = "Label15"
        Me.Label15.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label14
        '
        Me.Label14.BackColor = System.Drawing.Color.Transparent
        Me.Label14.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label14.Location = New System.Drawing.Point(256, 136)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(448, 24)
        Me.Label14.TabIndex = 13
        Me.Label14.Text = "Label14"
        '
        'Label13
        '
        Me.Label13.BackColor = System.Drawing.Color.Transparent
        Me.Label13.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label13.Location = New System.Drawing.Point(256, 112)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(448, 24)
        Me.Label13.TabIndex = 12
        Me.Label13.Text = "Label13"
        '
        'Label12
        '
        Me.Label12.BackColor = System.Drawing.Color.Transparent
        Me.Label12.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label12.Location = New System.Drawing.Point(256, 88)
        Me.Label12.Name = "Label12"
        Me.Label12.Size = New System.Drawing.Size(448, 24)
        Me.Label12.TabIndex = 11
        Me.Label12.Text = "Label12"
        '
        'Label11
        '
        Me.Label11.BackColor = System.Drawing.Color.Transparent
        Me.Label11.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label11.Location = New System.Drawing.Point(256, 64)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(448, 24)
        Me.Label11.TabIndex = 10
        Me.Label11.Text = "Label11"
        '
        'Label10
        '
        Me.Label10.BackColor = System.Drawing.Color.Transparent
        Me.Label10.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label10.Location = New System.Drawing.Point(352, 40)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(448, 24)
        Me.Label10.TabIndex = 9
        Me.Label10.Text = "Label10"
        '
        'Label9
        '
        Me.Label9.BackColor = System.Drawing.Color.Transparent
        Me.Label9.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label9.Location = New System.Drawing.Point(352, 16)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(448, 24)
        Me.Label9.TabIndex = 8
        Me.Label9.Text = "Label9"
        '
        'Label8
        '
        Me.Label8.BackColor = System.Drawing.Color.Transparent
        Me.Label8.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label8.Location = New System.Drawing.Point(-8, 184)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(176, 24)
        Me.Label8.TabIndex = 24
        Me.Label8.Text = "Label8"
        Me.Label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label3
        '
        Me.Label3.BackColor = System.Drawing.Color.Transparent
        Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label3.Location = New System.Drawing.Point(-8, 160)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(176, 24)
        Me.Label3.TabIndex = 23
        Me.Label3.Text = "Label3"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TxtMoneda2
        '
        Me.TxtMoneda2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TxtMoneda2.Location = New System.Drawing.Point(176, 184)
        Me.TxtMoneda2.Name = "TxtMoneda2"
        Me.TxtMoneda2.Size = New System.Drawing.Size(104, 20)
        Me.TxtMoneda2.TabIndex = 12
        Me.TxtMoneda2.Text = "TxtMoneda2"
        Me.TxtMoneda2.TxtMonedaBase = "0"
        Me.TxtMoneda2.TxtMonedaDecimales = Nothing
        '
        'TxtMoneda1
        '
        Me.TxtMoneda1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TxtMoneda1.Location = New System.Drawing.Point(176, 160)
        Me.TxtMoneda1.Name = "TxtMoneda1"
        Me.TxtMoneda1.Size = New System.Drawing.Size(104, 20)
        Me.TxtMoneda1.TabIndex = 11
        Me.TxtMoneda1.Text = "TxtMoneda1"
        Me.TxtMoneda1.TxtMonedaBase = "0"
        Me.TxtMoneda1.TxtMonedaDecimales = Nothing
        '
        'FlatRadioButton2
        '
        Me.FlatRadioButton2.BackColor = System.Drawing.Color.Transparent
        Me.FlatRadioButton2.Location = New System.Drawing.Point(176, 224)
        Me.FlatRadioButton2.Name = "FlatRadioButton2"
        Me.FlatRadioButton2.Size = New System.Drawing.Size(184, 16)
        Me.FlatRadioButton2.TabIndex = 16
        Me.FlatRadioButton2.Text = "FlatRadioButton2"
        '
        'FlatRadioButton1
        '
        Me.FlatRadioButton1.BackColor = System.Drawing.Color.Transparent
        Me.FlatRadioButton1.Location = New System.Drawing.Point(176, 208)
        Me.FlatRadioButton1.Name = "FlatRadioButton1"
        Me.FlatRadioButton1.Size = New System.Drawing.Size(184, 16)
        Me.FlatRadioButton1.TabIndex = 14
        Me.FlatRadioButton1.Text = "FlatRadioButton1"
        '
        'TextBox6
        '
        Me.TextBox6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TextBox6.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.TextBox6.Location = New System.Drawing.Point(176, 136)
        Me.TextBox6.MaxLength = 5
        Me.TextBox6.Name = "TextBox6"
        Me.TextBox6.Size = New System.Drawing.Size(70, 20)
        Me.TextBox6.TabIndex = 10
        Me.TextBox6.Text = "TEXTBOX6"
        '
        'Label7
        '
        Me.Label7.BackColor = System.Drawing.Color.Transparent
        Me.Label7.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label7.Location = New System.Drawing.Point(-8, 136)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(176, 24)
        Me.Label7.TabIndex = 22
        Me.Label7.Text = "Label7"
        Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox5
        '
        Me.TextBox5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TextBox5.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.TextBox5.Location = New System.Drawing.Point(176, 112)
        Me.TextBox5.MaxLength = 5
        Me.TextBox5.Name = "TextBox5"
        Me.TextBox5.Size = New System.Drawing.Size(70, 20)
        Me.TextBox5.TabIndex = 9
        Me.TextBox5.Text = "TEXTBOX5"
        '
        'Label6
        '
        Me.Label6.BackColor = System.Drawing.Color.Transparent
        Me.Label6.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label6.Location = New System.Drawing.Point(-8, 112)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(176, 24)
        Me.Label6.TabIndex = 21
        Me.Label6.Text = "Label6"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox4
        '
        Me.TextBox4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TextBox4.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.TextBox4.Location = New System.Drawing.Point(176, 88)
        Me.TextBox4.MaxLength = 5
        Me.TextBox4.Name = "TextBox4"
        Me.TextBox4.Size = New System.Drawing.Size(70, 20)
        Me.TextBox4.TabIndex = 8
        Me.TextBox4.Text = "TEXTBOX4"
        '
        'Label5
        '
        Me.Label5.BackColor = System.Drawing.Color.Transparent
        Me.Label5.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label5.Location = New System.Drawing.Point(-8, 88)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(176, 24)
        Me.Label5.TabIndex = 20
        Me.Label5.Text = "Label5"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox3
        '
        Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TextBox3.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.TextBox3.Location = New System.Drawing.Point(176, 64)
        Me.TextBox3.MaxLength = 5
        Me.TextBox3.Name = "TextBox3"
        Me.TextBox3.Size = New System.Drawing.Size(70, 20)
        Me.TextBox3.TabIndex = 7
        Me.TextBox3.Text = "TEXTBOX3"
        '
        'Label4
        '
        Me.Label4.BackColor = System.Drawing.Color.Transparent
        Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label4.Location = New System.Drawing.Point(-8, 64)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(176, 24)
        Me.Label4.TabIndex = 19
        Me.Label4.Text = "Label4"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox2
        '
        Me.TextBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TextBox2.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.TextBox2.Location = New System.Drawing.Point(176, 40)
        Me.TextBox2.MaxLength = 10
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(168, 20)
        Me.TextBox2.TabIndex = 6
        Me.TextBox2.Text = "TEXTBOX2"
        '
        'Label2
        '
        Me.Label2.BackColor = System.Drawing.Color.Transparent
        Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label2.Location = New System.Drawing.Point(-8, 40)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(176, 24)
        Me.Label2.TabIndex = 18
        Me.Label2.Text = "Label2"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'TextBox1
        '
        Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TextBox1.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
        Me.TextBox1.Location = New System.Drawing.Point(176, 16)
        Me.TextBox1.MaxLength = 10
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(168, 20)
        Me.TextBox1.TabIndex = 5
        Me.TextBox1.Text = "TEXTBOX1"
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(-8, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(176, 24)
        Me.Label1.TabIndex = 17
        Me.Label1.Text = "Label1"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'cmdDetalle
        '
        Me.cmdDetalle.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cmdDetalle.BackColor = System.Drawing.Color.Transparent
        Me.cmdDetalle.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.cmdDetalle.ForeColor = System.Drawing.Color.SteelBlue
        Me.cmdDetalle.Location = New System.Drawing.Point(640, 103)
        Me.cmdDetalle.Name = "cmdDetalle"
        Me.cmdDetalle.Size = New System.Drawing.Size(96, 88)
        Me.cmdDetalle.TabIndex = 1
        Me.cmdDetalle.Text = "Ver &Datos"
        '
        'dgDetalle
        '
        Me.dgDetalle.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.dgDetalle.BackgroundColor = System.Drawing.Color.Silver
        Me.dgDetalle.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.dgDetalle.CaptionBackColor = System.Drawing.Color.LightGray
        Me.dgDetalle.CaptionForeColor = System.Drawing.Color.Black
        Me.dgDetalle.CaptionText = "Actualizar Límite de Crédito"
        Me.dgDetalle.DataMember = ""
        Me.dgDetalle.FlatMode = True
        Me.dgDetalle.HeaderFont = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.dgDetalle.HeaderForeColor = System.Drawing.SystemColors.ControlText
        Me.dgDetalle.Location = New System.Drawing.Point(8, 16)
        Me.dgDetalle.Name = "dgDetalle"
        Me.dgDetalle.Size = New System.Drawing.Size(624, 264)
        Me.dgDetalle.TabIndex = 0
        '
        'cmdLimpiar
        '
        Me.cmdLimpiar.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cmdLimpiar.BackColor = System.Drawing.Color.Transparent
        Me.cmdLimpiar.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.cmdLimpiar.ForeColor = System.Drawing.Color.SteelBlue
        Me.cmdLimpiar.Location = New System.Drawing.Point(640, 190)
        Me.cmdLimpiar.Name = "cmdLimpiar"
        Me.cmdLimpiar.Size = New System.Drawing.Size(96, 88)
        Me.cmdLimpiar.TabIndex = 2
        Me.cmdLimpiar.Text = "&Limpiar"
        '
        'cmdProceso
        '
        Me.cmdProceso.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cmdProceso.BackColor = System.Drawing.Color.Transparent
        Me.cmdProceso.FlatStyle = System.Windows.Forms.FlatStyle.Popup
        Me.cmdProceso.ForeColor = System.Drawing.Color.SteelBlue
        Me.cmdProceso.Location = New System.Drawing.Point(640, 16)
        Me.cmdProceso.Name = "cmdProceso"
        Me.cmdProceso.Size = New System.Drawing.Size(96, 88)
        Me.cmdProceso.TabIndex = 0
        Me.cmdProceso.Text = "&Procesar"
        '
        'ActualizarLimiteCredito
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(744, 294)
        Me.Controls.Add(Me.dgDetalle)
        Me.Controls.Add(Me.cmdProceso)
        Me.Controls.Add(Me.cmdLimpiar)
        Me.Controls.Add(Me.cmdDetalle)
        Me.Controls.Add(Me.BottomRightColor)
        Me.Controls.Add(Me.TopLeftColor)
        Me.Controls.Add(Me.Label10)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.TxtMoneda2)
        Me.Controls.Add(Me.TxtMoneda1)
        Me.Controls.Add(Me.TextBox6)
        Me.Controls.Add(Me.TextBox5)
        Me.Controls.Add(Me.TextBox4)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.FlatRadioButton2)
        Me.Controls.Add(Me.FlatRadioButton1)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Label15)
        Me.Controls.Add(Me.Label14)
        Me.Controls.Add(Me.Label13)
        Me.Controls.Add(Me.Label12)
        Me.Controls.Add(Me.Label11)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.KeyPreview = True
        Me.Name = "ActualizarLimiteCredito"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Actualizar Límite Crédito"
        CType(Me.dgDetalle, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub ColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TopLeftColor.ColorChanged, BottomRightColor.ColorChanged
        Me.Refresh()
        Color1 = TopLeftColor.Color.Name.ToString
        Color2 = BottomRightColor.Color.Name.ToString
    End Sub

    Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
        Dim B As Brush
        Try
            B = New Drawing2D.LinearGradientBrush(Me.ClientRectangle, Me.TopLeftColor.Color, Me.BottomRightColor.Color, Drawing2D.LinearGradientMode.ForwardDiagonal)
            e.Graphics.FillRectangle(B, Me.ClientRectangle)
        Catch
        Finally
            If Not B Is Nothing Then
                B.Dispose()
            End If
        End Try
    End Sub

    Private Sub _Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
        Try
            MakeStyleDetalle()
        Catch ex As Exception

        End Try

        Me.Refresh()
    End Sub

    Private Sub Configuraciones()
        Dim Asm As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly
        Dim strConfigLoc As String = Asm.Location
        Dim strTemp As String
        strTemp = strConfigLoc
        strTemp = System.IO.Path.GetDirectoryName(strConfigLoc)
        Dim FileInfo As System.IO.FileInfo = New System.IO.FileInfo(strTemp & "\OndaNet.xml")
        Dim XmlDocument As New System.Xml.XmlDocument
        XmlDocument.Load(FileInfo.FullName)
        Dim Node As System.Xml.XmlNode
        For Each Node In XmlDocument.Item("configuration").Item("Usuario")
            If Node.Name = "add" Then
                If Node.Attributes.GetNamedItem("key").Value = Me.Name.ToString Then
                    If Node.Attributes.GetNamedItem("value").Value = "1" Then
                        Me.WindowState = FormWindowState.Maximized
                    Else
                        Me.WindowState = FormWindowState.Normal
                    End If
                End If
                If Node.Attributes.GetNamedItem("key").Value = Me.Name.ToString & "Color1" Then
                    TopLeftColor.Color = System.Drawing.Color.FromName(Node.Attributes.GetNamedItem("value").Value.ToString)
                End If
                If Node.Attributes.GetNamedItem("key").Value = Me.Name.ToString & "Color2" Then
                    BottomRightColor.Color = System.Drawing.Color.FromName(Node.Attributes.GetNamedItem("value").Value.ToString)
                End If
            End If
        Next Node
    End Sub

    Private Sub _Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        Dim Asm As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly
        Dim strConfigLoc As String = Asm.Location
        Dim strTemp As String
        strTemp = strConfigLoc
        strTemp = System.IO.Path.GetDirectoryName(strConfigLoc)
        Dim FileInfo As System.IO.FileInfo = New System.IO.FileInfo(strTemp & "\OndaNet.xml")
        Dim XmlDocument As New System.Xml.XmlDocument
        XmlDocument.Load(FileInfo.FullName)
        Dim Node As System.Xml.XmlNode
        For Each Node In XmlDocument.Item("configuration").Item("Usuario")
            If Node.Name = "add" Then
                If Node.Attributes.GetNamedItem("key").Value = Me.Name.ToString Then
                    If Me.WindowState = FormWindowState.Maximized Then
                        Node.Attributes.GetNamedItem("value").Value = CType("1", String)
                    Else
                        Node.Attributes.GetNamedItem("value").Value = CType("0", String)
                    End If
                End If
                If Node.Attributes.GetNamedItem("key").Value = Me.Name.ToString & "Color1" Then
                    Node.Attributes.GetNamedItem("value").Value = CType(Color1, String)
                End If
                If Node.Attributes.GetNamedItem("key").Value = Me.Name.ToString & "Color2" Then
                    Node.Attributes.GetNamedItem("value").Value = CType(Color2, String)
                End If
            End If
        Next Node
        XmlDocument.Save(FileInfo.FullName)
    End Sub

    Private Sub Salir(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
        Dim KeyAscii As Short = Asc(e.KeyChar)
        If KeyAscii = 27 Then
            Close()
        End If
    End Sub

    Private Sub Limpiar()

        TextBox1.Tag = 0
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        TxtMoneda1.Text = ""
        TxtMoneda2.Text = ""
        Label9.Text = ""
        Label10.Text = ""
        Label11.Text = ""
        Label12.Text = ""
        Label13.Text = ""
        Label14.Text = ""
        FlatRadioButton1.Checked = True
        ''dtDetalle.Rows.Clear()
        ''dgDetalle.DataSource = Nothing
        ''dgDetalle.TableStyles.Clear()
        dgDetalle.Visible = False

        Try
            dgDetalle.UnSelect(dgDetalle.CurrentRowIndex)
        Catch ex As Exception

        End Try

        TextBox1.Focus()
    End Sub

    Private Sub Texto()
        MakeTableDetalle()

        Label1.Text = "Desde Cliente"
        Label2.Text = "Hasta Cliente"
        Label4.Text = "Desde Vendedor"
        Label5.Text = "Hasta Vendedor"
        Label6.Text = "Desde Tipo de Cliente"
        Label7.Text = "Hasta Tipo de Cliente"
        Label3.Text = "Importe"
        Label8.Text = "Porcentaje"
        Label15.Text = "Tipo"

        FlatRadioButton1.Text = "Por Importe"
        FlatRadioButton2.Text = "Por Porcentaje"

        TxtMoneda2.TxtMonedaDecimales = CANDECIMALESCANTIDAD

        cmdProceso.Text = "&Procesar"
        cmdLimpiar.Text = "&Limpiar"
        cmdDetalle.Text = "Ver &Datos"


        Tool1.SetToolTip(Me.cmdDetalle, "Muestra los Valores establecidos como parámetro")
        Tool1.SetToolTip(Me.cmdLimpiar, "Limpia los parametros establecidos")

        If funcion.Descripcion_Tabla("DECIMALES", "MONEDA", "NUMMONEDA", MONEDA1, EmpCodigo) = 0 Then
            TxtMoneda1.TxtMonedaDecimales = 0
            canDecimales = 0
        Else
            TxtMoneda1.TxtMonedaDecimales = CANDECIMALESIMPORTE
            canDecimales = CANDECIMALESCANTIDAD
        End If

        AddHandler Me.KeyPress, AddressOf Me.Salir
    End Sub

    Private Sub _Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AsignarEventos(Me)
        Texto()
        Limpiar()
        Configuraciones()
    End Sub

    Public Sub Procesar()
        armar_condiciones()

        If FlatRadioButton1.Checked = True Then
            importes = TxtMoneda1.TxtMonedaBase
            modo = 0
            If TxtMoneda1.Text = "" Then
                Mensaje("No ha ingresado un criterio de Actualización")
                TxtMoneda1.Focus()
                Exit Sub
            End If
        Else
            importes = TxtMoneda2.TxtMonedaBase
            modo = 1
            If TxtMoneda2.Text = "" Then
                Mensaje("No ha ingresado un criterio de Actualización")
                TxtMoneda2.Focus()
                Exit Sub
            End If
        End If

        If MsgBox("¿Está seguro de realizar este proceso?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Actualizar Límite de Crédito") = MsgBoxResult.Yes Then
            If sentLimiteCredito.Actualizar(observacion, importes, modo, condiciones, UsuCodigo, EmpCodigo) = True Then
                Mensaje("Proceso realizado correctamente")
                Limpiar()
            Else
                Mensaje("El proceso no se ha realizado")
            End If
        Else
            cmdProceso.Focus()
        End If

        cmdDetalle.Text = "Ver &Datos"
    End Sub

    Private Sub armar_condiciones()
        condiciones = "" : observacion = ""

        'CLIENTE
        If TextBox1.Text.Length <> 0 And TextBox2.Text.Length <> 0 Then
            condiciones = condiciones + "AND NUMCLIENTE >= '" & TextBox1.Text & "' AND NUMCLIENTE <= '" & TextBox2.Text & "' "
            observacion = " Clientes : Desde " & TextBox1.Text & " Hasta: " & TextBox2.Text
        End If
        If TextBox1.Text.Length <> 0 And TextBox2.Text.Length = 0 Then
            condiciones = condiciones + "AND NUMCLIENTE >= '" & TextBox1.Text & "'"
            observacion = " Cliente: Desde " & TextBox1.Text
        End If
        If TextBox1.Text.Length = 0 And TextBox2.Text.Length <> 0 Then
            condiciones = condiciones + "AND NUMCLIENTE <= '" & TextBox2.Text & "' "
            observacion = " Cliente: Hasta " & TextBox2.Text
        End If
        If TextBox1.Text.Length = 0 And TextBox2.Text.Length = 0 Then
            observacion = " Cliente: Todos los Clientes"
        End If

        'VENDEDOR
        If TextBox3.Text.Length <> 0 And TextBox4.Text.Length <> 0 Then
            condiciones = condiciones + "AND CODVENDEDOR IN(SELECT CODVENDEDOR FROM VENDEDOR WHERE NUMVENDEDOR >= '" & TextBox3.Text & "') AND CODVENDEDOR IN(SELECT CODVENDEDOR FROM VENDEDOR WHERE NUMVENDEDOR <= '" & TextBox4.Text & "') "
            observacion = observacion + " Vendedor: Desde " & TextBox3.Text & " Hasta " & TextBox4.Text
        End If
        If TextBox3.Text.Length <> 0 And TextBox4.Text.Length = 0 Then
            condiciones = condiciones + "AND CODVENDEDOR IN(SELECT CODVENDEDOR FROM VENDEDOR WHERE NUMVENDEDOR >= '" & TextBox3.Text & "')"
            observacion = observacion + " Vendedor: Desde " & TextBox3.Text
        End If
        If TextBox3.Text.Length = 0 And TextBox4.Text.Length <> 0 Then
            condiciones = condiciones + "CODVENDEDOR IN(SELECT CODVENDEDOR FROM VENDEDOR WHERE NUMVENDEDOR <= '" & TextBox4.Text & "') "
            observacion = observacion + " Vendedor: Hasta " & TextBox4.Text
        End If
        If TextBox3.Text.Length = 0 And TextBox4.Text.Length = 0 Then
            observacion = observacion + " Vendedor: Todos los Vendedores"
        End If

        'TIPO CLIENTE
        If TextBox5.Text.Length <> 0 And TextBox6.Text.Length <> 0 Then
            condiciones = condiciones + "AND CODTIPOCLIENTE IN(SELECT CODTIPOCLIENTE FROM TIPOCLIENTE WHERE NUMTIPOCLIENTE >= '" & TextBox5.Text & "') AND CODTIPOCLIENTE IN(SELECT CODTIPOCLIENTE FROM TIPOCLIENTE WHERE NUMTIPOCLIENTE <= '" & TextBox6.Text & "') "
            observacion = observacion + " Tipo Cliente: Desde " & TextBox5.Text & " Hasta " & TextBox6.Text
        End If
        If TextBox5.Text.Length <> 0 And TextBox6.Text.Length = 0 Then
            condiciones = condiciones + "AND CODTIPOCLIENTE IN(SELECT CODTIPOCLIENTE FROM TIPOCLIENTE WHERE NUMTIPOCLIENTE >= '" & TextBox5.Text & "')"
            observacion = observacion + " Tipo Cliente: Desde " & TextBox5.Text
        End If
        If TextBox5.Text.Length = 0 And TextBox6.Text.Length <> 0 Then
            condiciones = condiciones + "CODTIPOCLIENTE IN(SELECT CODTIPOCLIENTE FROM TIPOCLIENTE WHERE NUMTIPOCLIENTE <= '" & TextBox6.Text & "') "
            observacion = observacion + " Tipo Cliente: Hasta " & TextBox6.Text
        End If
        If TextBox5.Text.Length = 0 And TextBox6.Text.Length = 0 Then
            observacion = observacion + " Todos los Tipo de Clientes"
        End If
    End Sub

    Private Sub ArmarCondicion()
        condicion = "" : condicion1 = ""
        'CLIENTE
        If TextBox1.Text.Length <> 0 And TextBox2.Text.Length <> 0 Then
            condicion = condicion + "AND C.NUMCLIENTE >= '" & TextBox1.Text & "' AND C.NUMCLIENTE <= '" & TextBox2.Text & "' "
        End If
        If TextBox1.Text.Length <> 0 And TextBox2.Text.Length = 0 Then
            condicion = condicion + "AND C.NUMCLIENTE >= '" & TextBox1.Text & "'"
        End If
        If TextBox1.Text.Length = 0 And TextBox2.Text.Length <> 0 Then
            condicion = condicion + "AND C.NUMCLIENTE <= '" & TextBox2.Text & "' "
        End If
        
        'VENDEDOR
        If TextBox3.Text.Length <> 0 And TextBox4.Text.Length <> 0 Then
            condicion = condicion + "AND C.CODVENDEDOR IN(SELECT CODVENDEDOR FROM VENDEDOR WHERE NUMVENDEDOR >= '" & TextBox3.Text & "') AND C.CODVENDEDOR IN(SELECT CODVENDEDOR FROM VENDEDOR WHERE NUMVENDEDOR <= '" & TextBox4.Text & "') "
        End If
        If TextBox3.Text.Length <> 0 And TextBox4.Text.Length = 0 Then
            condicion = condicion + "AND C.CODVENDEDOR IN(SELECT CODVENDEDOR FROM VENDEDOR WHERE NUMVENDEDOR >= '" & TextBox3.Text & "')"
        End If
        If TextBox3.Text.Length = 0 And TextBox4.Text.Length <> 0 Then
            condicion = condicion + "C.CODVENDEDOR IN(SELECT CODVENDEDOR FROM VENDEDOR WHERE NUMVENDEDOR <= '" & TextBox4.Text & "') "
        End If
       
        'TIPO CLIENTE
        If TextBox5.Text.Length <> 0 And TextBox6.Text.Length <> 0 Then
            condicion = condicion + "AND C.CODTIPOCLIENTE IN(SELECT CODTIPOCLIENTE FROM TIPOCLIENTE WHERE NUMTIPOCLIENTE >= '" & TextBox5.Text & "') AND C.CODTIPOCLIENTE IN(SELECT CODTIPOCLIENTE FROM TIPOCLIENTE WHERE NUMTIPOCLIENTE <= '" & TextBox6.Text & "') "
        End If
        If TextBox5.Text.Length <> 0 And TextBox6.Text.Length = 0 Then
            condicion = condicion + "AND C.CODTIPOCLIENTE IN(SELECT CODTIPOCLIENTE FROM TIPOCLIENTE WHERE NUMTIPOCLIENTE >= '" & TextBox5.Text & "')"
        End If
        If TextBox5.Text.Length = 0 And TextBox6.Text.Length <> 0 Then
            condicion = condicion + "C.CODTIPOCLIENTE IN(SELECT CODTIPOCLIENTE FROM TIPOCLIENTE WHERE NUMTIPOCLIENTE <= '" & TextBox6.Text & "') "
        End If
    End Sub

    'KeyPress
    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        '13 ENTER
        '32 ESPACIO
        '42 *
        '8 Borrar
        Dim KeyAscii As Short = Asc(e.KeyChar)

        If InStr(StringCadena, Chr(KeyAscii)) = 0 Then
            KeyAscii = 0
        Else                'Si es una tecla válida
            If KeyAscii = 13 Then           'Enter
                TextBox2.Focus()
            End If

            If KeyAscii = 42 Then
                'Buscar_Tabla("CLIENTES", "APELLIDO", "CODCLIENTE", "NUMCLIENTE", "Buscar Clientes", "", "", _
                '"", "NOMBRE", "Nombre", "NUMCEDULA", "DNI", "RUC", "RUC", "FECHAINGRESO", "Fecha de Ingreso")
                Buscar_Tabla_Complejo("CLIENTES", "APELLIDO", "CODCLIENTE", "NUMCLIENTE", "Buscar Clientes", "", "", _
                       "", "NOMBRE", "Nombre", "NUMCEDULA", "DNI", "RUC", "RUC", "FECHAINGRESO", "Fecha de Ingreso")

                If Not Campo_clave_tablas = 0 Then
                    TextBox1.Tag = Campo_clave_tablas
                    TextBox1.Text = Campo_numero_tablas
                    Label9.Text = funcion.Descripcion_Tabla("RTRIM(APELLIDO)+'  '+RTRIM(NOMBRE)", "CLIENTES", "CODCLIENTE", Campo_clave_tablas, EmpCodigo)
                End If

                KeyAscii = 0
            End If
        End If

        If KeyAscii = 0 Then
            e.Handled = True
        End If
    End Sub

    Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        '13 ENTER
        '32 ESPACIO
        '42 *
        '8 Borrar
        Dim KeyAscii As Short = Asc(e.KeyChar)

        If InStr(StringCadena, Chr(KeyAscii)) = 0 Then
            KeyAscii = 0
        Else                'Si es una tecla válida
            If KeyAscii = 13 Then           'Enter
                TextBox3.Focus()
            End If

            If KeyAscii = 42 Then
                'Buscar_Tabla("CLIENTES", "APELLIDO", "CODCLIENTE", "NUMCLIENTE", "Buscar Clientes", "", "", _
                '"", "NOMBRE", "Nombre", "NUMCEDULA", "DNI", "RUC", "RUC", "FECHAINGRESO", "Fecha de Ingreso")
                Buscar_Tabla_Complejo("CLIENTES", "APELLIDO", "CODCLIENTE", "NUMCLIENTE", "Buscar Clientes", "", "", _
                       "", "NOMBRE", "Nombre", "NUMCEDULA", "DNI", "RUC", "RUC", "FECHAINGRESO", "Fecha de Ingreso")

                If Not Campo_clave_tablas = 0 Then
                    TextBox2.Tag = Campo_clave_tablas
                    TextBox2.Text = Campo_numero_tablas
                    Label10.Text = funcion.Descripcion_Tabla("RTRIM(APELLIDO)+'   '+RTRIM(NOMBRE)", "CLIENTES", "CODCLIENTE", Campo_clave_tablas, EmpCodigo)
                End If

                KeyAscii = 0
            End If
        End If

        If KeyAscii = 0 Then
            e.Handled = True
        End If
    End Sub

    Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
        '13 ENTER
        '32 ESPACIO
        '42 *
        '8 Borrar
        Dim KeyAscii As Short = Asc(e.KeyChar)

        If InStr(StringCadena, Chr(KeyAscii)) = 0 Then
            KeyAscii = 0
        Else                'Si es una tecla válida
            If KeyAscii = 13 Then           'Enter
                TextBox4.Focus()
            End If

            If KeyAscii = 42 Then
                Buscar_Tabla("VENDEDOR", "DESVENDEDOR", "CODVENDEDOR", "NUMVENDEDOR", "Buscar Vendedor")

                If Not Campo_clave_tablas = 0 Then
                    TextBox3.Tag = Campo_clave_tablas
                    TextBox3.Text = Campo_numero_tablas
                    Label11.Text = Campo_descripcion_tablas
                End If

                KeyAscii = 0
            End If
        End If

        If KeyAscii = 0 Then
            e.Handled = True
        End If
    End Sub

    Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
        '13 ENTER
        '32 ESPACIO
        '42 *
        '8 Borrar
        Dim KeyAscii As Short = Asc(e.KeyChar)

        If InStr(StringCadena, Chr(KeyAscii)) = 0 Then
            KeyAscii = 0
        Else                'Si es una tecla válida
            If KeyAscii = 13 Then           'Enter
                TextBox5.Focus()
            End If

            If KeyAscii = 42 Then
                Buscar_Tabla("VENDEDOR", "DESVENDEDOR", "CODVENDEDOR", "NUMVENDEDOR", "Buscar Vendedor")

                If Not Campo_clave_tablas = 0 Then
                    TextBox4.Tag = Campo_clave_tablas
                    TextBox4.Text = Campo_numero_tablas
                    Label12.Text = Campo_descripcion_tablas
                End If

                KeyAscii = 0
            End If
        End If

        If KeyAscii = 0 Then
            e.Handled = True
        End If
    End Sub

    Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
        '13 ENTER
        '32 ESPACIO
        '42 *
        '8 Borrar
        Dim KeyAscii As Short = Asc(e.KeyChar)

        If InStr(StringCadena, Chr(KeyAscii)) = 0 Then
            KeyAscii = 0
        Else                'Si es una tecla válida
            If KeyAscii = 13 Then           'Enter
                TextBox6.Focus()
            End If

            If KeyAscii = 42 Then
                Buscar_Tabla("TIPOCLIENTE", "DESTIPOCLIENTE", "CODTIPOCLIENTE", "NUMTIPOCLIENTE", "Buscar Tipo de Cliente")

                If Not Campo_clave_tablas = 0 Then
                    TextBox5.Tag = Campo_clave_tablas
                    TextBox5.Text = Campo_numero_tablas
                    Label13.Text = Campo_descripcion_tablas
                End If

                KeyAscii = 0
            End If
        End If

        If KeyAscii = 0 Then
            e.Handled = True
        End If
    End Sub

    Private Sub TextBox6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
        '13 ENTER
        '32 ESPACIO
        '42 *
        '8 Borrar
        Dim KeyAscii As Short = Asc(e.KeyChar)

        If InStr(StringCadena, Chr(KeyAscii)) = 0 Then
            KeyAscii = 0
        Else                'Si es una tecla válida
            If KeyAscii = 13 Then           'Enter
                If FlatRadioButton1.Checked = True Then
                    TxtMoneda1.Focus()
                Else
                    TxtMoneda2.Focus()
                End If
            End If

            If KeyAscii = 42 Then
                Buscar_Tabla("TIPOCLIENTE", "DESTIPOCLIENTE", "CODTIPOCLIENTE", "NUMTIPOCLIENTE", "Buscar Tipo de Cliente")

                If Not Campo_clave_tablas = 0 Then
                    TextBox6.Tag = Campo_clave_tablas
                    TextBox6.Text = Campo_numero_tablas
                    Label14.Text = Campo_descripcion_tablas
                End If

                KeyAscii = 0
            End If
        End If

        If KeyAscii = 0 Then
            e.Handled = True
        End If
    End Sub

    Private Sub TxtMoneda1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtMoneda1.KeyPress
        '13 ENTER
        '32 ESPACIO
        '42 *
        '8 Borrar
        Dim Keyascii As Short = Asc(e.KeyChar)
        If Keyascii = 13 Then
            cmdProceso.Focus()
        End If
    End Sub

    Private Sub TxtMoneda2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtMoneda2.KeyPress
        '13 ENTER
        '32 ESPACIO
        '42 *
        '8 Borrar
        Dim Keyascii As Short = Asc(e.KeyChar)
        If Keyascii = 13 Then
            cmdProceso.Focus()
        End If
    End Sub

    'KeyDown
    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        Select Case e.KeyCode
            Case Keys.Up
                If FlatRadioButton1.Checked = True Then
                    TxtMoneda1.Focus()
                Else
                    TxtMoneda2.Focus()
                End If
                e.Handled = True
            Case Keys.Down
                TextBox2.Focus()
                e.Handled = True
        End Select
    End Sub

    Private Sub TextBox2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox2.KeyDown
        Select Case e.KeyCode
            Case Keys.Up
                TextBox1.Focus()
                e.Handled = True
            Case Keys.Down
                TextBox3.Focus()
                e.Handled = True
        End Select
    End Sub

    Private Sub TextBox3_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox3.KeyDown
        Select Case e.KeyCode
            Case Keys.Up
                TextBox2.Focus()
                e.Handled = True
            Case Keys.Down
                TextBox4.Focus()
                e.Handled = True
        End Select
    End Sub

    Private Sub TextBox4_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox4.KeyDown
        Select Case e.KeyCode
            Case Keys.Up
                TextBox3.Focus()
                e.Handled = True
            Case Keys.Down
                TextBox5.Focus()
                e.Handled = True
        End Select
    End Sub

    Private Sub TextBox5_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox5.KeyDown
        Select Case e.KeyCode
            Case Keys.Up
                TextBox4.Focus()
                e.Handled = True
            Case Keys.Down
                TextBox6.Focus()
                e.Handled = True
        End Select
    End Sub

    Private Sub TextBox6_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox6.KeyDown
        Select Case e.KeyCode
            Case Keys.Up
                TextBox5.Focus()
                e.Handled = True
            Case Keys.Down
                If FlatRadioButton1.Checked = True Then
                    TxtMoneda1.Focus()
                Else
                    TxtMoneda2.Focus()
                End If
                e.Handled = True
        End Select
    End Sub

    Private Sub TxtMoneda1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TxtMoneda1.KeyDown
        Select Case e.KeyCode
            Case Keys.Up
                TextBox6.Focus()
                e.Handled = True
            Case Keys.Down
                TextBox1.Focus()
                e.Handled = True
        End Select
    End Sub

    Private Sub TxtMoneda2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TxtMoneda2.KeyDown
        Select Case e.KeyCode
            Case Keys.Up
                TextBox6.Focus()
                e.Handled = True
            Case Keys.Down
                TextBox1.Focus()
                e.Handled = True
        End Select
    End Sub

    'Validated
    Private Sub TextBox1_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Validated
        Mensaje(funcion.descripcion_rango(TextBox1, Label9, "NUMCLIENTE", "CLIENTES", "RTRIM(APELLIDO)+'  '+RTRIM(NOMBRE)", EmpCodigo))
    End Sub

    Private Sub TextBox2_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Validated
        Mensaje(funcion.descripcion_rango(TextBox2, Label10, "NUMCLIENTE", "CLIENTES", "RTRIM(APELLIDO)+'  '+RTRIM(NOMBRE)", EmpCodigo))
    End Sub

    Private Sub TextBox3_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.Validated
        Mensaje(funcion.descripcion_rango(TextBox3, Label11, "NUMVENDEDOR", "VENDEDOR", "DESVENDEDOR", EmpCodigo))
    End Sub

    Private Sub TextBox4_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox4.Validated
        Mensaje(funcion.descripcion_rango(TextBox4, Label12, "NUMVENDEDOR", "VENDEDOR", "DESVENDEDOR", EmpCodigo))
    End Sub

    Private Sub TextBox5_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.Validated
        Mensaje(funcion.descripcion_rango(TextBox5, Label13, "NUMTIPOCLIENTE", "TIPOCLIENTE", "DESTIPOCLIENTE", EmpCodigo))
    End Sub

    Private Sub TextBox6_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox6.Validated
        Mensaje(funcion.descripcion_rango(TextBox6, Label14, "NUMTIPOCLIENTE", "TIPOCLIENTE", "DESTIPOCLIENTE", EmpCodigo))
    End Sub

    'Detalle
    Private Sub CargarDetalle()
        'Limpia la tabla y vuelve a cargar 
        'los datos de la Orden de Trabajo
        dtDetalle.Rows.Clear()

        Try
            dtDetalle = sentLimiteCredito.Cargar_Grilla(condicion, EmpCodigo, canDecimales)
        Catch e As Exception
            MsgBox(e.ToString)
        Finally
            MakeStyleDetalle()

            If Not dtDetalle.Rows.Count = 0 Then
                dgDetalle.DataSource = dtDetalle

                'Para mover el foco a la ultima linea del DataGrid
                Dim ultimaLinea As Integer = dtDetalle.Rows.Count - 1
                Dim cell As New DataGridCell(ultimaLinea, 0)

                dgDetalle.CurrentCell = cell
                cmdProceso.Focus()
            Else
                dgDetalle.TableStyles.Clear()
                dgDetalle.DataSource = Nothing
                Limpiar()
            End If
        End Try
    End Sub

    Private Sub MakeTableDetalle()
        dtDetalle = New DataTable("VERDETALLE")
        dtDetalle.Clear()

        Dim colNumCliente As DataColumn
        colNumCliente = New DataColumn("NUMCLIENTE", GetType(System.String))

        Dim colDesCliente As DataColumn
        colDesCliente = New DataColumn("DESCLIENTE", GetType(System.String))

        Dim colLimCredito As DataColumn
        colLimCredito = New DataColumn("LIMCREDITO", GetType(System.String))

        dtDetalle.Columns.Add(colNumCliente)
        dtDetalle.Columns.Add(colDesCliente)
        dtDetalle.Columns.Add(colLimCredito)
    End Sub

    Private Sub MakeStyleDetalle()
        Dim ts1 As New DataGridTableStyle

        ts1.MappingName = "VerDetalle"
        ts1.AlternatingBackColor = Color.LightGray
        ts1.AllowSorting = False
        ts1.ReadOnly = True

        Dim TextCol As New DataGridTextBoxColumn
        TextCol.MappingName = "NUMCLIENTE"
        TextCol.HeaderText = "Código"
        TextCol.Width = 100
        TextCol.ReadOnly = True
        ts1.GridColumnStyles.Add(TextCol)

        TextCol = New DataGridTextBoxColumn
        TextCol.MappingName = "DESCLIENTE"
        TextCol.HeaderText = "Razón Social"
        TextCol.Width = Me.Width - (100 + 150 + 200)
        TextCol.ReadOnly = True
        ts1.GridColumnStyles.Add(TextCol)

        TextCol = New DataGridTextBoxColumn
        TextCol.MappingName = "LIMCREDITO"
        TextCol.HeaderText = "Límite"
        TextCol.Width = 150
        TextCol.ReadOnly = True
        ts1.GridColumnStyles.Add(TextCol)

        ts1.SelectionBackColor = System.Drawing.Color.PaleGreen
        ts1.HeaderFont = New Font("Microsoft Sans Serif", 8, FontStyle.Bold)

        dgDetalle.TableStyles.Clear()
        dgDetalle.TableStyles.Add(ts1)
        dgDetalle.ReadOnly = True
    End Sub

    Private Sub dgDetalle_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs)
        cmdProceso.Focus()
    End Sub

    'Click
    Private Sub cmdProceso_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdProceso.Click
        Procesar()
    End Sub

    Private Sub cmdLimpiar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLimpiar.Click
        Limpiar()
        condicion1 = ""
    End Sub

    Private Sub cmdDetalle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDetalle.Click
        If cmdDetalle.Text = "Ver &Datos" Then
            cmdDetalle.Text = "Ocultar &Datos"

            If condicion1 = "" Then
                ArmarCondicion()
            End If

            CargarDetalle()

            dgDetalle.Visible = True
        ElseIf cmdDetalle.Text = "Ocultar &Datos" Then
            dgDetalle.Visible = False
            cmdDetalle.Text = "Ver &Datos"
        End If
    End Sub

    Private Sub FlatRadioButton1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles FlatRadioButton1.CheckedChanged, FlatRadioButton2.CheckedChanged
        If FlatRadioButton1.Checked = True Then
            TxtMoneda2.Text = ""
            TxtMoneda2.ReadOnly = True
            TxtMoneda1.ReadOnly = False
            TxtMoneda1.Focus()
        Else
            TxtMoneda1.Text = ""
            TxtMoneda1.ReadOnly = True
            TxtMoneda2.ReadOnly = False
            TxtMoneda2.Focus()
        End If
    End Sub
End Class