Option Strict Off
Option Explicit On
Friend Class frmCadTabIndDicFicDmic
	Inherits System.Windows.Forms.Form
	Private irstIcDicFicDmic As ADODB.Recordset
	Private iblnNovo As Boolean
	
	Private Sub frmCadTabIndDicFicDmic_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		Me.Width = VB6.TwipsToPixelsX(6765)
		Me.Height = VB6.TwipsToPixelsY(4140)
		With Me.fmePesquisa
			Call .SetBounds(Me.fmeCadastro.Left, 0, 0, 0, Windows.Forms.BoundsSpecified.X)
			.Visible = False
			.Enabled = False
		End With
		irstIcDicFicDmic = New ADODB.Recordset
		Call cmdLocalizar_Click(cmdLocalizar, New System.EventArgs())
	End Sub
	
	Private Sub frmCadTabIndDicFicDmic_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Escape Then
			Call cmdFechar_Click(cmdFechar, New System.EventArgs())
		ElseIf KeyAscii = System.Windows.Forms.Keys.Return Then 
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub cmdNovo_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdNovo.Click
		iblnNovo = True
		Call LimpaCampos()
	End Sub
	
	Private Sub cmdSalvar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdSalvar.Click
		Dim lstrSql As String
		
		lstrSql = ""
		If Me.txtId.Text = "0" Or iblnNovo Then
			lstrSql = lstrSql & "INSERT INTO `ic_dicficdmic` SET " & vbCrLf
			lstrSql = lstrSql & "       `id`        = " & CInt(Me.txtId.Text)
			lstrSql = lstrSql & "       `id_codigo` = " & CInt(Me.txtIdCodigo.Text)
		Else
			lstrSql = lstrSql & "UPDATE `ic_dicficdmic` SET " & vbCrLf
		End If
		lstrSql = lstrSql & "       `dic_anual`      = " & Replace(CStr(CDbl(Replace(Me.txtDic(0).Text, ".", ""))), ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `dic_trimestral` = " & Replace(CStr(CDbl(Replace(Me.txtDic(1).Text, ".", ""))), ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `dic_mensal`     = " & Replace(CStr(CDbl(Replace(Me.txtDic(2).Text, ".", ""))), ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `fic_anual`      = " & Replace(CStr(CDbl(Replace(Me.txtFic(0).Text, ".", ""))), ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `fic_trimestral` = " & Replace(CStr(CDbl(Replace(Me.txtFic(1).Text, ".", ""))), ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `fic_mensal`     = " & Replace(CStr(CDbl(Replace(Me.txtFic(2).Text, ".", ""))), ",", ".") & ", " & vbCrLf
		lstrSql = lstrSql & "       `dmic_mensal`    = " & Replace(CStr(CDbl(Replace(Me.txtDmic(2).Text, ".", ""))), ",", ".") & " "
		If Not iblnNovo Then
			lstrSql = lstrSql & " WHERE `ic_dicficdmic`.`id`        = " & CInt(Me.txtId.Text)
			lstrSql = lstrSql & "   AND `ic_dicficdmic`.`id_codigo` = " & CInt(Me.txtIdCodigo.Text)
		End If
		Call Executar(lstrSql)
		Call cmdLocalizar_Click(cmdLocalizar, New System.EventArgs())
	End Sub
	
	Private Sub cmdExcluir_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdExcluir.Click
		Dim lstrSql As String
		If MsgBox("Deseja realmente excluir este registro!", MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2, gstrTituloMensagem) = MsgBoxResult.Yes Then
			lstrSql = ""
			lstrSql = lstrSql & "DELETE FROM `ic_dicficdmic` "
			lstrSql = lstrSql & " WHERE `ic_dicficdmic`.`id`        = " & CInt(Me.txtId.Text)
			lstrSql = lstrSql & "   AND `ic_dicficdmic`.`id_codigo` = " & CInt(Me.txtIdCodigo.Text)
			Call Executar(lstrSql)
		End If
	End Sub
	
	Private Sub cmdLocalizar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLocalizar.Click
		Call LigDesFrame(True)
		Call MontaGrid()
	End Sub
	
	Private Sub cmdFechar_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdFechar.Click
		'UPGRADE_NOTE: Object irstIcDicFicDmic may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"'
		irstIcDicFicDmic = Nothing
		Call Me.Close()
	End Sub
	
	Private Sub MontaGrid()
		With Me.mfgDados
			Call .Clear()
			.Redraw = False
			.Rows = 1
			.Cols = 5
			.set_ColWidth(0, 1000)
			.set_ColWidth(1, 1000)
			.set_ColWidth(2, 1000)
			.set_ColWidth(3, 1000)
			.set_ColWidth(4, 1000)
			.set_TextMatrix(0, 0, "Tabela")
			.set_TextMatrix(0, 1, "Fx.Dec/Fec")
			.set_TextMatrix(0, 2, "DIC Mensal")
			.set_TextMatrix(0, 3, "FIC Mensal")
			.set_TextMatrix(0, 4, "DMIC Mensal")
			Call PopulaGrid()
			.Redraw = True
		End With
	End Sub
	
	Private Sub PopulaGrid()
		Dim lstrSql As String
		Dim llngIdTab As Integer
		Dim llngIdCod As Integer
		Dim ldblDicMe As Double
		Dim ldblFicMe As Double
		Dim ldblDMicM As Double
		
		On Error GoTo ErroPopulaGrid
		
		If irstIcDicFicDmic.State = ADODB.ObjectStateEnum.adStateOpen Then Call irstIcDicFicDmic.Close()
		irstIcDicFicDmic.Filter = ""
		lstrSql = ""
		lstrSql = lstrSql & "   SELECT `ic_dicficdmic`.`id`, "
		lstrSql = lstrSql & "          `ic_dicficdmic`.`id_codigo`, "
		lstrSql = lstrSql & "          `ic_dicficdmic`.`dic_anual`, "
		lstrSql = lstrSql & "          `ic_dicficdmic`.`dic_trimestral`, "
		lstrSql = lstrSql & "          `ic_dicficdmic`.`dic_mensal`, "
		lstrSql = lstrSql & "          `ic_dicficdmic`.`fic_anual`, "
		lstrSql = lstrSql & "          `ic_dicficdmic`.`fic_trimestral`, "
		lstrSql = lstrSql & "          `ic_dicficdmic`.`fic_mensal`, "
		lstrSql = lstrSql & "          `ic_dicficdmic`.`dmic_mensal` "
		lstrSql = lstrSql & "     FROM `ic_dicficdmic` "
		lstrSql = lstrSql & " ORDER BY `ic_dicficdmic`.`id` ASC, `ic_dicficdmic`.`id_codigo` ASC "
		Call Conectar(lstrSql, irstIcDicFicDmic)
		With irstIcDicFicDmic
			If .RecordCount > 0 Then
				While Not .EOF
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					llngIdTab = CInt(IIf(IsDbNull(.Fields("id").value), 0, .Fields("id").value))
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					llngIdCod = CInt(IIf(IsDbNull(.Fields("id_codigo").value), 0, .Fields("id_codigo").value))
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					ldblDicMe = CDbl(IIf(IsDbNull(.Fields("dic_mensal").value), 0, .Fields("dic_mensal").value))
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					ldblFicMe = CDbl(IIf(IsDbNull(.Fields("fic_mensal").value), 0, .Fields("fic_mensal").value))
					'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
					ldblDMicM = CDbl(IIf(IsDbNull(.Fields("dmic_mensal").value), 0, .Fields("dmic_mensal").value))
					With Me.mfgDados
						.Rows = .Rows + 1
						.set_TextMatrix(.Rows - 1, 0, llngIdTab)
						.set_TextMatrix(.Rows - 1, 1, llngIdCod)
						.set_TextMatrix(.Rows - 1, 2, FormatNumber(ldblDicMe, 2))
						.set_TextMatrix(.Rows - 1, 3, FormatNumber(ldblFicMe, 2))
						.set_TextMatrix(.Rows - 1, 4, FormatNumber(ldblDMicM, 2))
					End With
					Call .MoveNext()
				End While
			Else
				Call MsgBox("Não existe registros! ", MsgBoxStyle.Exclamation, gstrTituloMensagem)
			End If
			Call .MoveFirst()
		End With
ErroPopulaGrid: 
		With myConC
			If .Errors.Count > 0 Then
				Call MsgBox("Código: " & .Errors.Item(.Errors.Count - 1).NativeError & vbCrLf & "Descrição:" & .Errors.Item(.Errors.Count - 1).Description)
			End If
		End With
		System.Windows.Forms.Application.DoEvents()
	End Sub
	
	Private Sub LigDes(ByVal ablnModo As Boolean)
		Dim lintIdx As Short
		Me.txtId.Enabled = ablnModo
		Me.txtId.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(ablnModo, System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Window), System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Control)))
		Me.txtIdCodigo.Enabled = ablnModo
		Me.txtIdCodigo.BackColor = System.Drawing.ColorTranslator.FromOle(IIf(ablnModo, System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Window), System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Control)))
		For lintIdx = 0 To 3
			Me.txtDic(lintIdx).Enabled = ablnModo
			Me.txtDic(lintIdx).BackColor = System.Drawing.ColorTranslator.FromOle(IIf(ablnModo, System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Window), System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Control)))
			Me.txtFic(lintIdx).Enabled = ablnModo
			Me.txtFic(lintIdx).BackColor = System.Drawing.ColorTranslator.FromOle(IIf(ablnModo, System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Window), System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Control)))
			Me.txtDmic(lintIdx).Enabled = ablnModo
			Me.txtDmic(lintIdx).BackColor = System.Drawing.ColorTranslator.FromOle(IIf(ablnModo, System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Window), System.Drawing.ColorTranslator.ToOle(System.Drawing.SystemColors.Control)))
		Next lintIdx
	End Sub
	
	Private Sub mfgDados_DblClick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles mfgDados.DblClick
		Dim teste As Object
		With Me.mfgDados
			If .Rows > 1 Then
				Call LigDesFrame(False)
				irstIcDicFicDmic.Filter = ""
				Call irstIcDicFicDmic.MoveLast()
				Call irstIcDicFicDmic.MoveFirst()
				irstIcDicFicDmic.Filter = "id = " & .get_TextMatrix(.RowSel, 0)
				Call irstIcDicFicDmic.Find("id_codigo = " & .get_TextMatrix(.RowSel, 1), 1, ADODB.SearchDirectionEnum.adSearchForward, irstIcDicFicDmic.Bookmark)
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.EOF
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.BOF
				'UPGRADE_WARNING: Couldn't resolve default property of object irstIcDicFicDmic.Bookmark. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.Bookmark
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.AbsolutePage
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.AbsolutePosition
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.CursorLocation
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.CursorType
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.DataMember
				'UPGRADE_WARNING: Couldn't resolve default property of object irstIcDicFicDmic.DataSource. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.DataSource
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.EditMode
				'UPGRADE_WARNING: Couldn't resolve default property of object irstIcDicFicDmic.Filter. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.Filter
				'UPGRADE_WARNING: Couldn't resolve default property of object teste. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
				teste = irstIcDicFicDmic.LockType
				
				Call PegaDados()
			End If
		End With
	End Sub
	
	Private Sub LigDesFrame(ByVal ablnModo As Boolean)
		Me.fmePesquisa.Visible = ablnModo
		Me.fmePesquisa.Enabled = ablnModo
		Me.fmeCadastro.Enabled = (Not ablnModo)
	End Sub
	
	Private Sub LimpaCampos()
		Dim lintIdx As Short
		
		Me.txtId.Text = "0"
		Me.txtIdCodigo.Text = "0"
		For lintIdx = 0 To 3
			Me.txtDic(lintIdx).Text = "0,00"
			Me.txtFic(lintIdx).Text = "0,00"
			Me.txtDmic(lintIdx).Text = "0,00"
		Next lintIdx
	End Sub
	
	Private Sub PegaDados()
		With irstIcDicFicDmic
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtId.Text = CStr(CInt(IIf(IsDbNull(.Fields("id").value), 0, .Fields("id").value)))
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtIdCodigo.Text = CStr(CInt(IIf(IsDbNull(.Fields("id_codigo").value), 0, .Fields("id_codigo").value)))
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtDic(0).Text = FormatNumber(CDbl(IIf(IsDbNull(.Fields("dic_anual").value), 0, .Fields("dic_anual").value)), 2)
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtDic(1).Text = FormatNumber(CDbl(IIf(IsDbNull(.Fields("dic_trimestral").value), 0, .Fields("dic_trimestral").value)), 2)
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtDic(2).Text = FormatNumber(CDbl(IIf(IsDbNull(.Fields("dic_mensal").value), 0, .Fields("dic_mensal").value)), 2)
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtFic(0).Text = FormatNumber(CDbl(IIf(IsDbNull(.Fields("fic_anual").value), 0, .Fields("fic_anual").value)), 2)
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtFic(1).Text = FormatNumber(CDbl(IIf(IsDbNull(.Fields("fic_trimestral").value), 0, .Fields("fic_trimestral").value)), 2)
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtFic(2).Text = FormatNumber(CDbl(IIf(IsDbNull(.Fields("fic_mensal").value), 0, .Fields("fic_mensal").value)), 2)
			'UPGRADE_WARNING: Use of Null/IsNull() detected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="2EED02CB-5C0E-4DC1-AE94-4FAA3A30F51A"'
			Me.txtDmic(2).Text = FormatNumber(CDbl(IIf(IsDbNull(.Fields("dmic_mensal").value), 0, .Fields("dmic_mensal").value)), 2)
		End With
		iblnNovo = False
		Call Me.txtId.Focus()
		System.Windows.Forms.Application.DoEvents()
	End Sub
	
	Private Sub txtId_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtId.Enter
		With Me.txtId
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtId_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtId.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> 8 And (KeyAscii < 48 Or KeyAscii > 57) Then 
			KeyAscii = 0
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtIdCodigo_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtIdCodigo.Enter
		With Me.txtIdCodigo
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtIdCodigo_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtIdCodigo.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> 8 And (KeyAscii < 48 Or KeyAscii > 57) Then 
			KeyAscii = 0
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtDic_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtDic.Enter
		Dim Index As Short = txtDic.GetIndex(eventSender)
		With Me.txtDic(Index)
			.Text = Replace(Replace(.Text, ".", ""), ",", "")
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtDic_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtDic.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		Dim Index As Short = txtDic.GetIndex(eventSender)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> 8 And (KeyAscii < 48 Or KeyAscii > 57) Then 
			KeyAscii = 0
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtDic_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtDic.Leave
		Dim Index As Short = txtDic.GetIndex(eventSender)
		With Me.txtDic(Index)
			.Text = FormatNumber(IIf(Len(.Text) = 0, 0, (CDbl(.Text) / 100)), 2)
		End With
	End Sub
	
	Private Sub txtFic_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtFic.Enter
		Dim Index As Short = txtFic.GetIndex(eventSender)
		With Me.txtFic(Index)
			.Text = Replace(Replace(.Text, ".", ""), ",", "")
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtFic_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtFic.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		Dim Index As Short = txtFic.GetIndex(eventSender)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> 8 And (KeyAscii < 48 Or KeyAscii > 57) Then 
			KeyAscii = 0
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtFic_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtFic.Leave
		Dim Index As Short = txtFic.GetIndex(eventSender)
		With Me.txtFic(Index)
			.Text = FormatNumber(IIf(Len(.Text) = 0, 0, (CDbl(.Text) / 100)), 2)
		End With
	End Sub
	
	Private Sub txtDmic_Enter(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtDmic.Enter
		Dim Index As Short = txtDmic.GetIndex(eventSender)
		With Me.txtDmic(Index)
			.Text = Replace(Replace(.Text, ".", ""), ",", "")
			.SelectionStart = 0
			.SelectionLength = Len(.Text)
		End With
	End Sub
	
	Private Sub txtDmic_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtDmic.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		Dim Index As Short = txtDmic.GetIndex(eventSender)
		If KeyAscii = System.Windows.Forms.Keys.Return Then
			Call SendKeysA(System.Windows.Forms.Keys.Tab, True)
		ElseIf KeyAscii <> 8 And (KeyAscii < 48 Or KeyAscii > 57) Then 
			KeyAscii = 0
		End If
		eventArgs.KeyChar = Chr(KeyAscii)
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtDmic_Leave(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles txtDmic.Leave
		Dim Index As Short = txtDmic.GetIndex(eventSender)
		With Me.txtDmic(Index)
			.Text = FormatNumber(IIf(Len(.Text) = 0, 0, (CDbl(.Text) / 100)), 2)
		End With
	End Sub
End Class