'************************* 'octubre del 2005 'importacion de espacios de nombres o clases Imports CLIENTE.dmModulo Imports System.Data.SqlClient 'Imports AxMSFlexGridLib.AxMSFlexGrid Imports C1.Win.C1TrueDBGrid.C1TrueDBGrid 'Clase que me permite configurar los parametros para leer datos de tablas Public Class clsComplejo 'Declaracion de los instancias de objetos para conectarme a la base de datos Public Indice As Integer 'indice de la lista o combo Public cnString As String 'cadena de conexiòn de la BD Public lsSQL As String 'declaracion de datagrid Public cn As New SqlClient.SqlConnection() 'declaraciòn de conexiòn a la BD Public cm As New SqlClient.SqlCommand() 'declaraciòn de comando SQL Public dr As SqlClient.SqlDataReader 'Datareader Public ds As New DataSet() 'declaracion de dataset Public ad As New SqlClient.SqlDataAdapter() 'declaraciòn de adaptador Public dt As New DataTable 'declaracion de datatable Public Shared TipoReporte As Integer Public Shared _NoCuenta As String Public Shared _FechaIni As String Public Shared _FechaFin As String Public Sub sbLlenaCombo3(ByVal SQL As String, ByRef miCombo As ComboBox) sbConectaBD() Try miCombo.DataBindings.Clear() miCombo.DataSource = Nothing miCombo.Items.Clear() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm dt.Clear() ad.Fill(dt) miCombo.DataSource = dt miCombo.DisplayMember = "nombre" miCombo.ValueMember = "clave" Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaCombo3: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Function fdDataReader(ByVal SQL As String) As SqlClient.SqlDataReader 'funcion data reader, me permite leer los datos (solo lectura) sbConectaBD() Try cm.Connection = cn cm.CommandText = SQL cm.CommandTimeout = 0 dr = cm.ExecuteReader() Return dr dr.Close() Catch ex As Exception MessageBox.Show("Error en ClsComplejo; fdDataReader: " & ex.Message.ToString, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Function Public Function fiCuantosRegistros(ByVal SQL As String) As Integer sbConectaBD() Try cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm ad.Fill(dt) Return dt.Rows.Count Catch ex As Exception MessageBox.Show("Error en ClsComplejo; fiCuantosRegistros: ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Function Public Function fdtDataTable(ByVal SQL As String) As DataTable sbConectaBD() Try cm.Connection = cn cm.CommandText = SQL cm.CommandTimeout = 0 ad.SelectCommand = cm ad.Fill(dt) Return dt Catch ex As Exception MessageBox.Show("Error en ClsComplejo; fdtDataTable: ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Function Public Function fdtDataSet(ByVal SQL As String) As DataSet sbConectaBD() Try ds.Clear() cm.Connection = cn cm.CommandText = SQL cm.CommandTimeout = 0 ad.SelectCommand = cm ad.Fill(ds) Return ds Catch ex As Exception MessageBox.Show("Error en ClsComplejo; fdtDataSet: ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Function Public Function fdtDataSetTabla(ByVal SQL As String) As DataSet sbConectaBD() Try cm.Connection = cn cm.CommandText = SQL cm.CommandTimeout = 0 ad.SelectCommand = cm ds.Clear() ds.Tables.Clear() ad.Fill(ds, "Tabla") sbCierraCn() Return ds Catch ex As Exception MessageBox.Show("Problemas al recuperar los datos, en fdtDataSetTabla: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information) End Try End Function Public Sub sbGuardaModifica(ByVal SQL As String) 'Funcion que permite guardar la modificacion de un registro sbConectaBD() Try cm.Connection = cn cm.CommandText = SQL cm.ExecuteNonQuery() cm.Connection.Close() Catch ex As Exception MessageBox.Show("error en ClsComplejo; sbGuardaModifica: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Sub sbConectaBD() Try 'realiza la conexiòn a la BD If cn.State = ConnectionState.Closed Then 'la clase dmModulo me permite obtener el string de conexion 'cnString = dmModulo.SqlConnection.ConnectionString 'cn.ConnectionString = cnString Dim Conexion As LeeEditorRegistro = New LeeEditorRegistro 'agregada Dim valor As String 'agregada valor = clsVaribles.Conexion.ConnectionString 'agregada cn.ConnectionString = dmModulo.strConnection 'valor 'agregada cn.Open() 'abre la conexion End If Catch ex As Exception MessageBox.Show("error en ClsComplejo; sbConectaBD: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Public Sub ConectaBD() Try 'Declaro una instancia dela clase LeeEditorRegistro, la cual me ayuda 'a recuperar la cadena conexion If cn.State = ConnectionState.Closed Then Dim Conexion As LeeEditorRegistro = New LeeEditorRegistro Dim valor As String valor = clsVaribles.Conexion.ConnectionString cn.ConnectionString = valor cn.Open() End If Catch ex As Exception MessageBox.Show("error en ClsComplejo; ConectaBD: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Public Sub sbCierraCn() 'cierra la conexiòn a la BD cn.Close() End Sub Public Sub sbCierraDataReader() 'cierra el datareader dr.Close() End Sub Public Sub sbLlenaLista(ByVal SQL As String, ByVal miLista As ListBox) Try miLista.DataSource = Nothing miLista.Items.Clear() dt.Clear() 'llena una lista con la sentencia SQL especificada ConectaBD() 'la original es sbConectaBD() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm ad.Fill(dt) miLista.DataSource = dt miLista.DisplayMember = "nombre" miLista.ValueMember = "clave" Catch ex As Exception MessageBox.Show("error en ClsComplejo; sbLlenaLista: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Sub sbLlenaMSFGrid(ByVal SQL As String, ByVal miFGrid As AxMSFlexGridLib.AxMSFlexGrid) 'llena un MSFlexGrid con la sentencia SQL especificada Dim j As Integer Dim i As Integer Dim TotalCampos As Integer Dim CadenaValores As String Dim ValorCampo As Object 'MsgBox("clsConmplejo; sbLlenaMSFGrid: " & SQL) Try If SQL <> "" Then sbConectaBD() cm.Connection = cn cm.CommandText = SQL dr = cm.ExecuteReader() With miFGrid Try .Visible = False .Rows = 1 TotalCampos = dr.FieldCount() .Cols = TotalCampos .FixedCols = 0 .Row = 0 For i = 0 To .Cols - 1 .Col = i .Text = dr.GetName(i) Next Catch End Try End With CadenaValores = "" While dr.Read() miFGrid.Rows = miFGrid.Rows + 1 For i = 0 To TotalCampos - 1 miFGrid.Col = i miFGrid.Row = miFGrid.Rows - 1 miFGrid.Text = IIf(dr.IsDBNull(i), "", dr.GetValue(i)) Next i End While miFGrid.Visible = True End If Catch ex As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaMSFGrid: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally dr.Close() sbCierraCn() End Try End Sub Public Sub sbLlenaDataGrid(ByVal SQL As String, ByVal miDataGrid As DataGrid) 'AxMSDBGrid.AxDBGrid) 'ByVal miDataGrid As DataGrid 'llena un DBGrid con la sentencia SQL especificada sbConectaBD() 'MsgBox("clsCompejo; sbLlenaDataGrid: " & SQL) Try cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm dt.Clear() ' dt ad.Fill(dt) 'dt miDataGrid.DataSource = dt 'dt Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaDataGrid: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Sub sbLlenaDataGridView(ByVal SQL As String, ByVal miDataGrid As DataGridView) 'AxMSDBGrid.AxDBGrid) 'ByVal miDataGrid As DataGrid 'llena un DBGrid con la sentencia SQL especificada sbConectaBD() 'MsgBox("clsCompejo; sbLlenaDataGrid: " & SQL) Try cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm dt.Clear() ' dt ad.Fill(dt) 'dt miDataGrid.DataSource = dt 'dt Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaDataGrid: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Function OcultarColumna(ByVal NombreColumna As String) 'Oculta columnas al usuario Try ds.Tables("Tabla").Columns(NombreColumna).ColumnMapping = MappingType.Hidden Catch ex As Exception ' MessageBox.Show("Error en la clase clComplejo en OcultarColumna " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Function Public Sub sbLlenaDevExpress(ByVal SQL As String, ByVal miDevExpress As DevExpress.XtraGrid.GridControl) Try 'llena un DevExpress con la sentencia SQL especificada sbConectaBD() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm dt.Clear() ad.Fill(dt) miDevExpress.DataSource() = dt Catch ex As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaDevExpress: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally sbCierraCn() End Try End Sub Public Sub sbConfiguraGrid(ByVal miDGrid As DataGrid, ByVal aiAncho() As Integer) Try Dim DGts As DataGridTableStyle = New DataGridTableStyle Dim i As Integer With miDGrid DGts.MappingName = miDGrid.DataMember .TableStyles.Clear() .TableStyles.Add(DGts) End With For i = 1 To UBound(aiAncho) + 1 With miDGrid .TableStyles(0).GridColumnStyles(i - 1).Width = aiAncho(i - 1) End With Next Catch ex As Exception MessageBox.Show("Error en ClsComplejo; sbConfiguraGrid: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Public Sub sbLlenaCombo(ByVal SQL As String, ByRef miCombo As ComboBox) 'funcion que me permite llenar combos a traves de un procedimiento almacenado 'On Error Resume Next 'llena un combo con la sentencia SQL especificada sbConectaBD() Try miCombo.DataBindings.Clear() miCombo.DataSource = Nothing miCombo.Items.Clear() dt.Clear() cm.Connection = cn cm.CommandText = SQL cm.CommandTimeout = 0 ad.SelectCommand = cm dt.Clear() ad.Fill(dt) miCombo.DataSource = dt miCombo.DisplayMember = "nombre" miCombo.ValueMember = "clave" Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaCombo: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally sbCierraCn() End Try End Sub Public Sub sbLlenaCheckListBox(ByVal SQL As String, ByRef miCheckedListBox As CheckedListBox) 'funcion que me permite llenar combos a traves de un procedimiento almacenado 'On Error Resume Next 'llena un combo con la sentencia SQL especificada sbConectaBD() Try miCheckedListBox.DataBindings.Clear() miCheckedListBox.DataSource = Nothing miCheckedListBox.Items.Clear() dt.Clear() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm dt.Clear() ad.Fill(dt) miCheckedListBox.DataSource = dt miCheckedListBox.DisplayMember = "nombre" miCheckedListBox.ValueMember = "clave" Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaCheckListBox: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally sbCierraCn() End Try End Sub Public Sub sbLlenaCombo1(ByVal SQL As String, ByRef miCombo As ComboBox) 'funcion que me permite llenar combos a traves de un procedimiento almacenado 'On Error Resume Next 'llena un combo con la sentencia SQL especificada sbConectaBD() Try miCombo.DataBindings.Clear() miCombo.DataSource = Nothing miCombo.Items.Clear() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm dt.Clear() ad.Fill(dt) miCombo.DataSource = dt miCombo.DisplayMember = "Nombre" miCombo.ValueMember = "Clave" Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaCombo1: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Sub sbBuscaEnCombo(ByVal Valor As String, ByVal miCombo As ComboBox) 'busca un elemento especìfico (Valor) en el combo Indice = miCombo.FindStringExact(Valor) miCombo.SelectedIndex = Indice End Sub Public Sub sbBuscaEnLista(ByVal Valor As String, ByVal miLista As ListBox) 'busca un elemento especìfico (Valor) en la lista Indice = miLista.FindStringExact(Valor) miLista.SelectedIndex = Indice End Sub Public Sub sbLimpiaControles(ByVal Forma As Form) Dim lcCtrl As Object For Each lcCtrl In Forma.Controls If TypeOf lcCtrl Is TextBox Then lcCtrl.text = "" End If If TypeOf lcCtrl Is ComboBox Then lcCtrl.Selectedindex = -1 lcCtrl.text = "" 'MsgBox("limpio combo") End If If TypeOf lcCtrl Is CheckBox Then lcCtrl.Checked = False 'MsgBox("limpio chcek") End If Next lcCtrl End Sub Public Sub sbDesHabilitaControles(ByVal Forma As Form) 'sub que deshabilita los controles de un formulario Dim Ctrl As Object For Each Ctrl In Forma.Controls If TypeOf Ctrl Is TextBox Then Ctrl.Enabled = False End If If TypeOf Ctrl Is CheckBox Then Ctrl.Enabled = False End If If TypeOf Ctrl Is ComboBox Then Ctrl.Enabled = False End If Next End Sub Public Sub sbHabilitaControles(ByVal Forma As Form) 'sub que habilita los controles de un formulario Dim Ctrl As Object For Each Ctrl In Forma.Controls If TypeOf Ctrl Is TextBox Then Ctrl.Enabled = True End If If TypeOf Ctrl Is CheckBox Then Ctrl.Enabled = True End If If TypeOf Ctrl Is ComboBox Then Ctrl.Enabled = True End If Next End Sub Public Function fbSoloNumeroEntero(ByVal Caja As TextBox, ByVal Tipo As Object) As Boolean If Len(Caja.Text) = 0 Then MessageBox.Show("Es obligatorio el campo", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information) Caja.Focus() 'Le da el foco Return False 'Indica que la caja esta vacia Exit Function Else If Not IsNumeric(Caja.Text) Then MessageBox.Show("Debes escribir un numero", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information) Caja.Focus() Return False Exit Function Else Dim lcCaracteres() As Char Dim lcUnCaracter As Char Dim x, y As Integer y = Caja.Text.Length - 1 ' pasamos la cadena a convertir a un array Char lcCaracteres = Caja.Text.ToCharArray() For x = 0 To y lcUnCaracter = lcCaracteres(x) If Not Char.IsDigit(lcUnCaracter) Then MessageBox.Show("Debes escribir un numero entero", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information) Caja.Focus() Return False Exit For Exit Function Else MsgBox("si es un numero entero") Return True 'Indica que si es numero End If Next End If End If End Function Public Function fbValidaTexto(ByVal Texto As TextBox, ByVal Var As Object, ByVal Tipo As String) As Boolean If Len(Texto.Text) = 0 Then Return False Exit Function Else Select Case Tipo Case Is = "int" If Not IsNumeric(Texto.Text) Then Return False Exit Function Else Var = CInt(Texto.Text) End If Case Is = "str" Var = Trim(CStr(Texto.Text)) Case Is = "dbl" If Not IsNumeric(Texto.Text) Then Return False Exit Function Else Var = CDbl(Texto.Text) End If End Select End If Return True End Function Public Function fbValidaCombo(ByVal Combo As ComboBox, ByVal Var As Object) As Boolean If Combo.SelectedIndex = -1 Then Return False Exit Function Else Var = Combo.SelectedValue End If Return True End Function Public Function VerificaCheckList(ByVal IdCliente As Long, ByVal IDDocto As Integer, ByRef FVer As String) As Boolean Dim clcmj1 As New clsComplejo Dim strChecacumple As String Dim Fila As DataRow strChecacumple = "SELECT Id_DoctoCheckList,cumple,fecha_prorroga FROM KYC_CheckList" strChecacumple = strChecacumple & " WHERE idcliente = " & IdCliente strChecacumple = strChecacumple & " AND Id_DoctoCheckList = " & IDDocto strChecacumple = strChecacumple & " AND cumple = 1 " ' strChecacumple = strChecacumple & " AND cumple IS NOT NULL " clcmj1.fdtDataSet(strChecacumple) If clcmj1.ds.Tables(0).Rows.Count <> 0 Then If IsDBNull(clcmj1.ds.Tables(0).Rows(0).Item("fecha_prorroga")) Then FVer = "" Else FVer = clcmj1.ds.Tables(0).Rows(0).Item("fecha_prorroga") End If VerificaCheckList = True Else VerificaCheckList = False End If End Function Public Function SumaDoctos(ByVal IdCliente As Long) As Long Dim clcmj1 As New clsComplejo Dim strChecacumple As String Dim Fila As DataRow strChecacumple = "SELECT tipopersona FROM cliente" strChecacumple = strChecacumple & " WHERE idcliente = " & IdCliente clcmj1.fdtDataSet(strChecacumple) If clcmj1.ds.Tables(0).Rows.Count <> 0 Then Fila = clcmj1.ds.Tables(0).Rows(0) strChecacumple = "SELECT COUNT(*) as suma FROM DoctosCheckList " strChecacumple = strChecacumple & " WHERE TipoPersona = " & Fila("Tipopersona") clcmj1.fdtDataSet(strChecacumple) Fila = Nothing Fila = clcmj1.ds.Tables(0).Rows(0) SumaDoctos = Fila("suma") End If End Function Public Sub sbModifica2(ByVal SQL As String) sbConectaBD() 'la original es sbConectaBD() Try dt.Clear() 'llena una lista con la sentencia SQL especificada cm.Connection = cn cm.Prepare() 'cm.CommandText = SQL cm = New SqlClient.SqlCommand(SQL, cn) 'ad.UpdateCommand = cm cm.ExecuteNonQuery() Catch ex As Exception MessageBox.Show("error en ClsComplejo; sbModifica2: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Sub sbInserta(ByVal SQL As String) Try dt.Clear() 'llena una lista con la sentencia SQL especificada sbConectaBD() 'ConectaBD() 'la original es sbConectaBD() cm.Connection = cn cm.CommandText = SQL cm.ExecuteNonQuery() cm.Connection.Close() Catch ex As Exception MessageBox.Show("error en ClsComplejo; sbInserta: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Sub GeneraCarta(ByVal Ruta As String, ByVal NombreArchivo As String) 'Dim ObjWord As Word.Application 'Try ' ObjWord = New Word.Application ' If ObjWord Is Nothing Then ' ObjWord = CreateObject("word.application") ' Else ' ObjWord = GetObject(, "word.application") ' End If ' ObjWord.Documents.Open(Ruta & NombreArchivo) ' ObjWord.Selection.Find.ClearFormatting() ' Dim FechaComodin As String ' Dim FechaDia As String ' Dim FechaMes As String ' Dim FechaAno As String ' Dim Rp As Word.WdReplace ' Dim Wp As Word.WdFindWrap ' ObjWord.Selection.Find.ClearFormatting() ' ObjWord.Selection.Find.Replacement.ClearFormatting() ' With ObjWord.Selection.Find ' .Text = "DEL DIA DE CAPTURA" ' FechaComodin = Format(System.DateTime.Today, "dd/mmmm/yyyy") ' FechaDia = Mid(FechaComodin, 1, 2) ' FechaMes = Mid(FechaComodin, 4, Len(FechaComodin) - 5) ' FechaAno = Mid(FechaComodin, Len(FechaComodin) - 5, Len(FechaComodin)) ' .Replacement.Text = FechaDia & " DE " & FechaMes & " DE " & FechaAno ' .Forward = True ' .Wrap = Wp.wdFindContinue ' .Format = False ' .MatchCase = False ' .MatchWholeWord = False ' .MatchWildcards = False ' .MatchSoundsLike = False ' .MatchAllWordForms = False ' End With ' ObjWord.Selection.Find.Execute(Replace:=Rp.wdReplaceAll) ' ObjWord.ActiveDocument.SaveAs(filename:="C:\prueba.doc") ' ObjWord.Documents.Close() 'Catch ex As Exception ' MessageBox.Show("error en ClsComplejo; sbLlenaLista: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) ' If Not ObjWord Is Nothing Then ' ObjWord = Nothing ' ObjWord.Documents.Close() ' ObjWord.Application.Quit() ' End If 'End Try End Sub Public Sub sbLlenaComboESP(ByVal SQL As String, ByRef miCombo As ComboBox, ByRef ValDisplay As String) 'funcion que me permite llenar combos a traves de un procedimiento almacenado 'On Error Resume Next 'llena un combo con la sentencia SQL especificada Dim MiDt As New DataTable sbConectaBD() Try miCombo.DataBindings.Clear() miCombo.DataSource = Nothing miCombo.Items.Clear() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm MiDt.Clear() ad.Fill(MiDt) miCombo.DataSource = MiDt miCombo.DisplayMember = ValDisplay miCombo.ValueMember = "clave" Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaComboESP: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub 'Sub RangesEsp(ByVal MyDoc As Word.Document) ' Dim FldRngGen(1, 17) As Word.Range ' Dim FldRngAct(1, 11) As Word.Range ' Dim FldRngApo1(1, 12) As Word.Range ' Dim FldRngApo2(1, 11) As Word.Range ' Dim FldRngApo3(1, 11) As Word.Range ' Dim FldRngApo4(1, 11) As Word.Range ' clsVaribles.FldRng1 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Cliente").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endCliente").Start - 1) ' clsVaribles.FldRng2 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Paterno").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endPaterno").Start - 1) ' clsVaribles.FldRng3 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Materno").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endMaterno").Start - 1) ' clsVaribles.FldRng4 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Direccion").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endDireccion").Start - 1) ' clsVaribles.FldRng5 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Exterior").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endExterior").Start - 1) ' clsVaribles.FldRng6 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Interior").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endInterior").Start - 1) ' clsVaribles.FldRng7 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Colonia").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endColonia").Start - 1) ' clsVaribles.FldRng8 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("CP").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endCP").Start - 1) ' clsVaribles.FldRng9 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Plaza").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endPlaza").Start - 1) ' clsVaribles.FldRng10 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Estado").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endEstado").Start - 1) 'End Sub 'Sub SaveFields(ByVal objWord As Word.Document, ByVal Grdbusqueda As DataGrid) ' 'NOMBRE ' If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 1)) Then ' clsVaribles.FldRng1.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 1) ' Else ' clsVaribles.FldRng1.Text = "" ' End If ' 'PATERNO ' If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 2)) Then ' clsVaribles.FldRng2.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 2) ' Else ' clsVaribles.FldRng2.Text = "" ' End If ' 'MATERNO ' If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 3)) Then ' clsVaribles.FldRng3.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 3) ' Else ' clsVaribles.FldRng3.Text = "" ' End If ' 'DIRECCION ' If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 4)) Then ' clsVaribles.FldRng4.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 4) ' Else ' clsVaribles.FldRng4.Text = "" ' End If ' 'EXTERIOR ' 'If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 5)) Then ' 'clsVaribles.FldRng5.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 5) ' 'Else ' clsVaribles.FldRng5.Text = "" ' 'End If ' 'INTERIOR ' 'If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 6)) Then ' 'clsVaribles.FldRng6.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 6) ' 'Else ' clsVaribles.FldRng6.Text = "" ' 'End If ' 'COLONIA ' If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 5)) Then ' clsVaribles.FldRng7.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 5) ' Else ' clsVaribles.FldRng7.Text = "" ' End If ' 'CP ' If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 6)) Then ' clsVaribles.FldRng8.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 6) ' Else ' clsVaribles.FldRng8.Text = "" ' End If ' 'PLAZA ' If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 7)) Then ' clsVaribles.FldRng9.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 7) ' Else ' clsVaribles.FldRng9.Text = "" ' End If ' 'ESTADO ' If Not IsDBNull(Grdbusqueda(Grdbusqueda.CurrentRowIndex, 8)) Then ' clsVaribles.FldRng10.Text = Grdbusqueda(Grdbusqueda.CurrentRowIndex, 8) ' Else ' clsVaribles.FldRng10.Text = "" ' End If 'End Sub 'Sub DatosGenerales(ByVal ObjWord As Word.Document) ' Dim Sql As String ' Dim Classcom As New clsComplejo ' Sql = "SELECT c.nombre,c.apaterno,c.amaterno,c.curp,c.rfc,c.domicilio," ' Sql = Sql & "c.colonia,dat.cp,p.nombreplaza as plaza,e.nombreestado as estado," ' Sql = Sql & "pa.nombre as pais,c.telefono,dat.fax,dat.telefonoext,dat.faxext " ' Sql = Sql & "FROM cliente c ,plaza p, estado e, pais pa ,kyc_datosgenerales dat " ' Sql = Sql & "WHERE c.id_plaza = p.id_plaza AND dat.id_estado = e.id_estado " ' Sql = Sql & "AND dat.id_pais = pa.id_pais AND c.idcliente = dat.idcliente " ' Sql = Sql & "AND dat.id_pais = pa.id_pais AND c.idcliente = dat.idcliente " ' Sql = Sql & "AND c.idcliente = " & clsVaribles.IDCliente ' Classcom.SetRangesGen(ObjWord) ' Classcom.SaveFieldsGen(ObjWord, Sql) ' Dim LaConsulta As String ' Dim Fila As DataRow ' Dim Fila2 As DataRow ' If clsVaribles.TipoPersona = 2 Then ' 'INFORMACION PARA EL ACTA CONSTITUTIVA ' LaConsulta = "SELECT a.NoActa,a.FechaActa,a.Notaria,a.notario,a.apaterno,a.amaterno," ' LaConsulta = LaConsulta & "p.nombreplaza as plazaNot,a.NoRPC,a.FechaRPC,a.Id_PlazaRPC " ' LaConsulta = LaConsulta & "FROM kyc_actaconstitutiva a, plaza p " ' LaConsulta = LaConsulta & "WHERE a.Id_PlazaNot = p.id_plaza " ' LaConsulta = LaConsulta & "AND a.idcliente = " & clsVaribles.IDCliente ' Call Classcom.SetRangesAct(ObjWord) ' Call Classcom.SaveFieldsAct(ObjWord, LaConsulta) ' 'INFORMACION PARA LOS APODERADOS ' LaConsulta = "SELECT nombre,apaterno,amaterno,id_relacion,id_ejercicio,NoActa," ' LaConsulta = LaConsulta & "FechaActa as fechaAct, NoNotaria,Notario,APaternoNot,AMaternoNot," ' LaConsulta = LaConsulta & "PlazaNot,NoFolio,fechafolio as fechaRPC,plazarpc " ' LaConsulta = LaConsulta & "FROM kyc_apoderado " ' LaConsulta = LaConsulta & "WHERE idcliente = " & clsVaribles.IDCliente ' 'rstRecordSet1 = db_PLD.Execute(LaConsulta) ' Call Classcom.SaveFieldsApo(ObjWord, LaConsulta) ' End If 'End Sub 'Sub SetRangesGen(ByVal MyDoc As Word.Document) ' clsVaribles.FldRngGen1 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Nombre").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endNombre").Start - 1) ' clsVaribles.FldRngGen2 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Curp").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endCurp").Start - 1) ' clsVaribles.FldRngGen3 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Rfc").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endRfc").Start - 1) ' clsVaribles.FldRngGen4 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Calle").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endCalle").Start - 1) ' clsVaribles.FldRngGen5 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ColoniaGen").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endColoniaGen").Start - 1) ' clsVaribles.FldRngGen6 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("CPGen").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endCPGen").Start - 1) ' clsVaribles.FldRngGen7 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Ciudad").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endCiudad").Start - 1) ' clsVaribles.FldRngGen8 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("EstadoGen").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endEstadoGen").Start - 1) ' clsVaribles.FldRngGen9 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Pais").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endPais").Start - 1) ' clsVaribles.FldRngGen10 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Telefono").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endTelefono").Start - 1) ' clsVaribles.FldRngGen11 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Fax").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endFax").Start - 1) 'End Sub 'Sub SaveFieldsGen(ByVal MyDoc As Word.Document, ByVal SQl As String) ' Dim Classcom As New clsComplejo ' Dim Fila As DataRow ' Dim Clsvar As clsVaribles ' Try ' 'SQl = "SELECT c.nombre,c.apaterno,c.amaterno,c.curp,c.rfc,c.domicilio," ' 'SQl = SQl & "c.colonia,dat.cp,p.nombre as plaza,e.nombre as estado," ' 'SQl = SQl & "pa.paisnom,c.telefono,dat.fax,dat.telextension,dat.faxextension " ' 'SQl = SQl & "FROM cliente c ,plaza p, estado e, pais pa ,kyc_datosgenerales dat " ' 'SQl = SQl & "WHERE c.id_plaza = p.id_plaza AND dat.id_estado = e.id_estado " ' 'SQl = SQl & "AND dat.id_pais = pa.id_pais AND c.idcliente = dat.idcliente " ' 'SQl = SQl & "AND dat.id_pais = pa.id_pais AND c.idcliente = dat.idcliente " ' 'SQl = SQl & "AND c.idcliente = " & clsVaribles.IDCliente ' Classcom = New clsComplejo ' Classcom.fdtDataSet(SQl) ' If Classcom.ds.Tables(0).Rows.Count <> 0 Then ' Fila = Classcom.ds.Tables(0).Rows(0) ' clsVaribles.FldRngGen1.Text = Trim(Fila("clientenom") & "" & " " & Fila("apaterno") & "" & " " & Fila("amaterno") & "") ' If Not IsDBNull(Fila("curp")) Then ' clsVaribles.FldRngGen2.Text = Trim(Fila("curp")) & "" ' End If ' If Not IsDBNull(Fila("rfc")) Then ' clsVaribles.FldRngGen3.Text = Trim(Fila("rfc")) & "" ' End If ' If Not IsDBNull(Fila("domicilio")) Then ' clsVaribles.FldRngGen4.Text = Trim(Fila("domicilio")) & "" ' End If ' If Not IsDBNull(Fila("colonia")) Then ' clsVaribles.FldRngGen5.Text = Trim(Fila("colonia")) & "" ' End If ' If Not IsDBNull(Fila("cp")) Then ' clsVaribles.FldRngGen6.Text = Trim(Fila("cp")) ' End If ' If Not IsDBNull(Fila("plaza")) Then ' clsVaribles.FldRngGen7.Text = Trim(Fila("plaza")) ' End If ' If Not IsDBNull(Fila("estado")) Then ' clsVaribles.FldRngGen8.Text = Trim(Fila("estado")) ' End If ' If Not IsDBNull(Fila("pais")) Then ' clsVaribles.FldRngGen9.Text = Trim(Fila("pais")) ' End If ' If Not IsDBNull(Fila("telefono")) Then 'dat.telefonoext,dat.faxext " ' If Not IsDBNull(Trim(Fila("telefonoext"))) Then ' clsVaribles.FldRngGen10.Text = Trim(Fila("telefono")) & " EXT. " & Trim(Fila("telefonoext")) ' Else ' clsVaribles.FldRngGen10.Text = Trim(Fila("telefono")) ' End If ' End If ' If Not IsDBNull(Fila("fax")) Then ' If Not IsDBNull(Trim(Fila("faxext"))) Then ' clsVaribles.FldRngGen11.Text = Trim(Fila("fax")) & " EXT. " & Trim(Fila("faxext")) ' Else ' clsVaribles.FldRngGen11.Text = Trim(Fila("fax")) ' End If ' End If ' End If ' Catch ex As Exception ' MessageBox.Show("error en ClsComplejo; sbLlenaLista: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) ' End Try 'End Sub 'Sub SaveFieldsAct(ByVal MyDoc As Word.Document, ByVal sql As String) ' Dim classcom As New clsComplejo ' Dim Fila As DataRow ' Dim Fila2 As DataRow ' Dim Sql2 As String ' 'LaConsulta = "SELECT a.NoActa,a.FechaActa,a.Notaria,a.notario,a.apaterno,a.amaterno," ' 'LaConsulta = LaConsulta & "p.nombre as plazaNot,a.NoRPC,a.FechaRPC,a.Id_PlazaRPC " ' 'LaConsulta = LaConsulta & "FROM kyc_actaconstitutiva a, plaza p " ' 'LaConsulta = LaConsulta & "WHERE a.Id_PlazaNot = p.id_plaza " ' 'LaConsulta = LaConsulta & "AND a.idcliente = " & clsVaribles.IDCliente ' classcom.fdtDataSet(sql) ' If classcom.ds.Tables(0).Rows.Count <> 0 Then ' Fila = classcom.ds.Tables(0).Rows(0) ' 'Es necesario crear otra consulta para buscar la PlazaRPC ' Sql2 = "SELECT nombreplaza from plaza WHERE id_plaza = " & Fila("Id_PlazaRPC") ' classcom = New clsComplejo ' classcom.fdtDataSet(Sql2) ' If classcom.ds.Tables(0).Rows.Count <> 0 Then ' Fila2 = classcom.ds.Tables(0).Rows(0) ' End If ' clsVaribles.FldRngAct1.Text = Trim(Fila("NoActa") & "") ' clsVaribles.FldRngAct2.Text = Trim(Fila("FechaActa")) ' clsVaribles.FldRngAct3.Text = Trim(Fila("Notaria") & "") ' clsVaribles.FldRngAct4.Text = Trim(Fila("plazaNot")) ' clsVaribles.FldRngAct5.Text = Trim(Fila("notario") & "") ' clsVaribles.FldRngAct6.Text = Trim(Fila2("nombreplaza") & "") ' clsVaribles.FldRngAct7.Text = Trim(Fila("NoRPC") & "") ' clsVaribles.FldRngAct8.Text = Trim(Fila("FechaRPC")) ' End If 'End Sub 'Sub SaveFieldsApo(ByVal MyDoc As Word.Document, ByVal sql As String) ' Dim Classcom As New clsComplejo ' Dim Notario As String ' Dim Apoderado As String ' Dim Fila As DataRow ' Try ' 'LaConsulta = "SELECT nombre,apaterno,amaterno,id_relacion,id_ejercicio,NoActa," ' 'LaConsulta = LaConsulta & "FechaActa as fechaAct, NoNotaria,Notario,APaternoNot,AMaternoNot," ' 'LaConsulta = LaConsulta & "PlazaNot,NoFolio,fecha2 as fechaRPC,plazarpc " ' 'LaConsulta = LaConsulta & "FROM apoderados " ' 'LaConsulta = LaConsulta & "WHERE idcliente = " & clsVaribles.IDCliente ' Classcom.fdtDataSet(sql) ' If Classcom.ds.Tables(0).Rows.Count <> 0 Then ' For i As Integer = 0 To Classcom.ds.Tables(0).Rows.Count - 1 ' Fila = Classcom.ds.Tables(0).Rows(i) ' 'Es necesario crear otra consulta para buscar la PlazaRPC ' Notario = Fila("Notario") & "" & " " & Fila("APaternoNot") & "" & " " & Fila("AMaternoNot") & "" ' Apoderado = Fila("nombre") & "" & " " & Fila("apaterno") & "" & " " & Fila("amaterno") & "" ' Select Case i ' Case 0 ' Call Classcom.SetRangesApo1(MyDoc) ' Call SaveFieldsApo1(Apoderado, Fila("id_relacion"), Fila("id_ejercicio"), Fila("NoActa"), Fila("fechaAct"), Fila("NoNotaria"), Notario, Fila("plazaNot"), Fila("NoFolio"), Fila("fechaRPC"), Fila("plazaRPC")) ' Case 1 ' Call Classcom.SetRangesApo2(MyDoc) ' Call SaveFieldsApo2(Apoderado, Fila("id_relacion"), Fila("id_ejercicio"), Fila("NoActa"), Fila("fechaAct"), Fila("NoNotaria"), Notario, Fila("plazaNot"), Fila("NoFolio"), Fila("fechaRPC"), Fila("plazaRPC")) ' Case 2 ' Call Classcom.SetRangesApo3(MyDoc) ' Call SaveFieldsApo3(Apoderado, Fila("id_relacion"), Fila("id_ejercicio"), Fila("NoActa"), Fila("fechaAct"), Fila("NoNotaria"), Notario, Fila("plazaNot"), Fila("NoFolio"), Fila("fechaRPC"), Fila("plazaRPC")) ' Case 3 ' Call Classcom.SetRangesApo4(MyDoc) ' Call SaveFieldsApo4(Apoderado, Fila("id_relacion"), Fila("id_ejercicio"), Fila("NoActa"), Fila("fechaAct"), Fila("NoNotaria"), Notario, Fila("plazaNot"), Fila("NoFolio"), Fila("fechaRPC"), Fila("plazaRPC")) ' End Select ' Next ' End If ' Catch ex As Exception ' End Try 'End Sub Sub SaveFieldsApo1(ByVal Nombre As Object, ByVal relacion As Object, ByVal ejercicio As Object, ByVal noActa As Object, ByVal fechaAct As Object, ByVal noNotaria As Object, ByVal Notario As Object, ByVal plazaNot As Object, ByVal rpc As Object, ByVal fechaRPC As Object, ByVal plazaRPC As Object) ' Dim Nomb As String Dim Rela As String Dim Ejer As String Dim Noac As String Dim FeAc As String Dim NNot As String Dim Nota As String Dim PlNo As String Dim RRPC As String Dim FeRP As String Dim PlIs As String Dim Apoderados As String Nomb = "Nombre: " Rela = "Relación: " Ejer = "Ejercicio de Poderes: " Noac = "No. Acta: " FeAc = "Fecha de acta: " NNot = "No. Notaria: " Nota = "Notario: " PlNo = "Plaza de la notaria: " RRPC = "RPC: " FeRP = "Fecha RPC: " PlIs = "Plaza de inscripción: " Apoderados = "APODERADOS" 'clsVaribles.FldRngApo11.Text = Nomb & Trim(Nombre) 'clsVaribles.FldRngApo12.Text = Rela & Trim(relacion) 'clsVaribles.FldRngApo13.Text = Ejer & Trim(ejercicio) 'clsVaribles.FldRngApo14.Text = Noac & Trim(noActa) 'clsVaribles.FldRngApo15.Text = FeAc & Trim(fechaAct) 'clsVaribles.FldRngApo16.Text = NNot & Trim(noNotaria) 'clsVaribles.FldRngApo17.Text = Nota & Trim(Notario) 'clsVaribles.FldRngApo18.Text = PlNo & Trim(plazaNot) 'clsVaribles.FldRngApo19.Text = RRPC & Trim(rpc) 'clsVaribles.FldRngApo110.Text = FeRP & Trim(fechaRPC) 'clsVaribles.FldRngApo111.Text = PlIs & Trim(plazaRPC) 'clsVaribles.FldRngApo112.Text = Apoderados End Sub Sub SaveFieldsApo2(ByVal Nombre As Object, ByVal relacion As Object, ByVal ejercicio As Object, ByVal noActa As Object, ByVal fechaAct As Object, ByVal noNotaria As Object, ByVal Notario As Object, ByVal plazaNot As Object, ByVal rpc As Object, ByVal fechaRPC As Object, ByVal plazaRPC As Object) ' Dim Nomb As String Dim Rela As String Dim Ejer As String Dim Noac As String Dim FeAc As String Dim NNot As String Dim Nota As String Dim PlNo As String Dim RRPC As String Dim FeRP As String Dim PlIs As String Dim Apoderados As String Nomb = "Nombre: " Rela = "Relación: " Ejer = "Ejercicio de Poderes: " Noac = "No. Acta: " FeAc = "Fecha de acta: " NNot = "No. Notaria: " Nota = "Notario: " PlNo = "Plaza de la notaria: " RRPC = "RPC: " FeRP = "Fecha RPC: " PlIs = "Plaza de inscripción: " Apoderados = "APODERADOS" 'clsVaribles.FldRngApo21.Text = Nomb & Trim(Nombre) 'clsVaribles.FldRngApo22.Text = Rela & Trim(relacion) 'clsVaribles.FldRngApo23.Text = Ejer & Trim(ejercicio) 'clsVaribles.FldRngApo24.Text = Noac & Trim(noActa) 'clsVaribles.FldRngApo25.Text = FeAc & Trim(fechaAct) 'clsVaribles.FldRngApo26.Text = NNot & Trim(noNotaria) 'clsVaribles.FldRngApo27.Text = Nota & Trim(Notario) 'clsVaribles.FldRngApo28.Text = PlNo & Trim(plazaNot) 'clsVaribles.FldRngApo29.Text = RRPC & Trim(rpc) 'clsVaribles.FldRngApo210.Text = FeRP & Trim(fechaRPC) 'clsVaribles.FldRngApo211.Text = PlIs & Trim(plazaRPC) 'clsVaribles.FldRngApo212.Text = Apoderados End Sub Sub SaveFieldsApo3(ByVal Nombre As Object, ByVal relacion As Object, ByVal ejercicio As Object, ByVal noActa As Object, ByVal fechaAct As Object, ByVal noNotaria As Object, ByVal Notario As Object, ByVal plazaNot As Object, ByVal rpc As Object, ByVal fechaRPC As Object, ByVal plazaRPC As Object) ' Dim Nomb As String Dim Rela As String Dim Ejer As String Dim Noac As String Dim FeAc As String Dim NNot As String Dim Nota As String Dim PlNo As String Dim RRPC As String Dim FeRP As String Dim PlIs As String Dim Apoderados As String Nomb = "Nombre: " Rela = "Relación: " Ejer = "Ejercicio de Poderes: " Noac = "No. Acta: " FeAc = "Fecha de acta: " NNot = "No. Notaria: " Nota = "Notario: " PlNo = "Plaza de la notaria: " RRPC = "RPC: " FeRP = "Fecha RPC: " PlIs = "Plaza de inscripción: " Apoderados = "APODERADOS" 'clsVaribles.FldRngApo31.Text = Nomb & Trim(Nombre) 'clsVaribles.FldRngApo32.Text = Rela & Trim(relacion) 'clsVaribles.FldRngApo33.Text = Ejer & Trim(ejercicio) 'clsVaribles.FldRngApo34.Text = Noac & Trim(noActa) 'clsVaribles.FldRngApo35.Text = FeAc & Trim(fechaAct) 'clsVaribles.FldRngApo36.Text = NNot & Trim(noNotaria) 'clsVaribles.FldRngApo37.Text = Nota & Trim(Notario) 'clsVaribles.FldRngApo38.Text = PlNo & Trim(plazaNot) 'clsVaribles.FldRngApo39.Text = RRPC & Trim(rpc) 'clsVaribles.FldRngApo310.Text = FeRP & Trim(fechaRPC) 'clsVaribles.FldRngApo311.Text = PlIs & Trim(plazaRPC) 'clsVaribles.FldRngApo312.Text = Apoderados End Sub Sub SaveFieldsApo4(ByVal Nombre As Object, ByVal relacion As Object, ByVal ejercicio As Object, ByVal noActa As Object, ByVal fechaAct As Object, ByVal noNotaria As Object, ByVal Notario As Object, ByVal plazaNot As Object, ByVal rpc As Object, ByVal fechaRPC As Object, ByVal plazaRPC As Object) ' Dim Nomb As String Dim Rela As String Dim Ejer As String Dim Noac As String Dim FeAc As String Dim NNot As String Dim Nota As String Dim PlNo As String Dim RRPC As String Dim FeRP As String Dim PlIs As String Dim Apoderados As String Nomb = "Nombre: " Rela = "Relación: " Ejer = "Ejercicio de Poderes: " Noac = "No. Acta: " FeAc = "Fecha de acta: " NNot = "No. Notaria: " Nota = "Notario: " PlNo = "Plaza de la notaria: " RRPC = "RPC: " FeRP = "Fecha RPC: " PlIs = "Plaza de inscripción: " Apoderados = "APODERADOS" 'clsVaribles.FldRngApo41.Text = Nomb & Trim(Nombre) 'clsVaribles.FldRngApo42.Text = Rela & Trim(relacion) 'clsVaribles.FldRngApo43.Text = Ejer & Trim(ejercicio) 'clsVaribles.FldRngApo44.Text = Noac & Trim(noActa) 'clsVaribles.FldRngApo45.Text = FeAc & Trim(fechaAct) 'clsVaribles.FldRngApo46.Text = NNot & Trim(noNotaria) 'clsVaribles.FldRngApo47.Text = Nota & Trim(Notario) 'clsVaribles.FldRngApo48.Text = PlNo & Trim(plazaNot) 'clsVaribles.FldRngApo49.Text = RRPC & Trim(rpc) 'clsVaribles.FldRngApo410.Text = FeRP & Trim(fechaRPC) 'clsVaribles.FldRngApo411.Text = PlIs & Trim(plazaRPC) 'clsVaribles.FldRngApo412.Text = Apoderados End Sub 'Sub SetRangesApo1(ByVal MyDoc As Word.Document) ' clsVaribles.FldRngApo11 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNom1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNom1").Start - 1) ' clsVaribles.FldRngApo12 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoRel1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoRel1").Start - 1) ' clsVaribles.FldRngApo13 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoEjer1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoEjer1").Start - 1) ' clsVaribles.FldRngApo14 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNo1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNo1").Start - 1) ' clsVaribles.FldRngApo15 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoFA1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoFA1").Start - 1) ' clsVaribles.FldRngApo16 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNot1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNot1").Start - 1) ' clsVaribles.FldRngApo17 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNotario1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNotario1").Start - 1) ' clsVaribles.FldRngApo18 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoPN1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoPN1").Start - 1) ' clsVaribles.FldRngApo19 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoRPC1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoRPC1").Start - 1) ' clsVaribles.FldRngApo110 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoFR1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoFR1").Start - 1) ' clsVaribles.FldRngApo111 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoPR1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoPR1").Start - 1) ' clsVaribles.FldRngApo112 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Apoderados").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoderados").Start - 1) 'End Sub 'Sub SetRangesApo2(ByVal MyDoc As Word.Document) ' clsVaribles.FldRngApo21 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNom1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNom1").Start - 1) ' clsVaribles.FldRngApo22 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoRel1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoRel1").Start - 1) ' clsVaribles.FldRngApo23 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoEjer1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoEjer1").Start - 1) ' clsVaribles.FldRngApo24 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNo1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNo1").Start - 1) ' clsVaribles.FldRngApo25 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoFA1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoFA1").Start - 1) ' clsVaribles.FldRngApo26 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNot1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNot1").Start - 1) ' clsVaribles.FldRngApo27 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNotario1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNotario1").Start - 1) ' clsVaribles.FldRngApo28 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoPN1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoPN1").Start - 1) ' clsVaribles.FldRngApo29 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoRPC1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoRPC1").Start - 1) ' clsVaribles.FldRngApo210 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoFR1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoFR1").Start - 1) ' clsVaribles.FldRngApo211 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoPR1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoPR1").Start - 1) ' clsVaribles.FldRngApo212 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Apoderados").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoderados").Start - 1) 'End Sub 'Sub SetRangesApo3(ByVal MyDoc As Word.Document) ' clsVaribles.FldRngApo31 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNom1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNom1").Start - 1) ' clsVaribles.FldRngApo32 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoRel1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoRel1").Start - 1) ' clsVaribles.FldRngApo33 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoEjer1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoEjer1").Start - 1) ' clsVaribles.FldRngApo34 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNo1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNo1").Start - 1) ' clsVaribles.FldRngApo35 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoFA1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoFA1").Start - 1) ' clsVaribles.FldRngApo36 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNot1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNot1").Start - 1) ' clsVaribles.FldRngApo37 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNotario1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNotario1").Start - 1) ' clsVaribles.FldRngApo38 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoPN1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoPN1").Start - 1) ' clsVaribles.FldRngApo39 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoRPC1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoRPC1").Start - 1) ' clsVaribles.FldRngApo310 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoFR1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoFR1").Start - 1) ' clsVaribles.FldRngApo311 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoPR1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoPR1").Start - 1) ' clsVaribles.FldRngApo312 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Apoderados").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoderados").Start - 1) 'End Sub 'Sub SetRangesApo4(ByVal MyDoc As Word.Document) ' clsVaribles.FldRngApo41 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNom1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNom1").Start - 1) ' clsVaribles.FldRngApo42 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoRel1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoRel1").Start - 1) ' clsVaribles.FldRngApo43 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoEjer1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoEjer1").Start - 1) ' clsVaribles.FldRngApo44 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNo1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNo1").Start - 1) ' clsVaribles.FldRngApo45 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoFA1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoFA1").Start - 1) ' clsVaribles.FldRngApo46 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNot1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNot1").Start - 1) ' clsVaribles.FldRngApo47 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoNotario1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoNotario1").Start - 1) ' clsVaribles.FldRngApo48 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoPN1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoPN1").Start - 1) ' clsVaribles.FldRngApo49 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoRPC1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoRPC1").Start - 1) ' clsVaribles.FldRngApo410 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoFR1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoFR1").Start - 1) ' clsVaribles.FldRngApo411 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("ApoPR1").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoPR1").Start - 1) ' clsVaribles.FldRngApo412 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Apoderados").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endApoderados").Start - 1) 'End Sub 'Private Sub SetRangesAct(ByVal MyDoc As Word.Document) ' ' ' clsVaribles.FldRngAct1 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("NumAct").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endNumAct").Start - 1) ' clsVaribles.FldRngAct2 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("FechaAct").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endFechaAct").Start - 1) ' clsVaribles.FldRngAct3 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Notaria").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endNotaria").Start - 1) ' clsVaribles.FldRngAct4 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("PlazaNotaria").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endPlazaNotaria").Start - 1) ' clsVaribles.FldRngAct5 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("Notario").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endNotario").Start - 1) ' clsVaribles.FldRngAct6 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("PlazaIns").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endPlazaIns").Start - 1) ' clsVaribles.FldRngAct7 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("NumIns").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endNumIns").Start - 1) ' clsVaribles.FldRngAct8 = MyDoc.Range(Start:=MyDoc.Bookmarks.Item("FechaIns").Range.End, _ ' End:=MyDoc.Bookmarks.Item("endFechaIns").Start - 1) 'End Sub Public Function BuscaValores(ByVal SqlSELECT As String, ByVal SqlFROM As String, ByVal SqlWHERE As String) As Object Dim fila As DataRow Dim SQL As String Dim Classcom As New clsComplejo Try 'SqlWHERE = "" If SqlFROM = "MERCADO DE DINERO" Then SqlFROM = "MERCADO DE CAPITALES" SQL = "SELECT " & SqlSELECT & " " & " FROM " & SqlFROM.Replace(" ", "") If SqlWHERE <> "" Then SQL = SQL & " WHERE " & SqlWHERE End If Classcom.fdtDataSet(SQL) 'cm.Connection = cn2.cn 'cm.CommandText = SQL 'ad.SelectCommand = cm 'ad.Fill(ds) If Classcom.ds.Tables(0).Rows.Count <> 0 Then If IsDBNull(Classcom.ds.Tables(0).Rows(0)) Then Return "" Else Return Classcom.ds.Tables(0).Rows(0).Item(0) End If End If Catch ex As Exception MessageBox.Show("Error en ClsComplejo; BuscaValores: ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Function End Try End Function Public Sub sbLlenaCombo2(ByVal SQL As String, ByRef miCombo As ComboBox) 'funcion que me permite llenar combos a traves de un procedimiento almacenado 'On Error Resume Next 'llena un combo con la sentencia SQL especificada sbConectaBD() Try miCombo.DataBindings.Clear() miCombo.DataSource = Nothing miCombo.Items.Clear() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm dt.Clear() ad.Fill(dt) miCombo.DataSource = dt miCombo.DisplayMember = "nombre" miCombo.ValueMember = "clave" Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaCombo2: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Function ObtenFecha(ByVal FOriginal As Date, ByVal strFormato As String) As String Dim strFechaRet As String Select Case UCase(strFormato) Case Is = "DD/MM/YYYY" strFechaRet = Format(Microsoft.VisualBasic.Day(FOriginal), "00") & "/" & Format(Month(FOriginal), "00") & "/" & Year(FOriginal) Case Is = "YYYY/MM/DD" strFechaRet = Year(FOriginal) & "/" & Format(Month(FOriginal), "00") & "/" & Format(Microsoft.VisualBasic.Day(FOriginal), "00") Case Is = "MM/DD/YYYY" strFechaRet = Format(Month(FOriginal), "00") & "/" & Format(Microsoft.VisualBasic.Day(FOriginal), "00") & "/" & Year(FOriginal) Case Is = "DDMMYYYY" strFechaRet = Format(Microsoft.VisualBasic.Day(FOriginal), "00") & Format(Month(FOriginal), "00") & Year(FOriginal) Case Is = "DD/MMM/YY" strFechaRet = Format(Microsoft.VisualBasic.Day(FOriginal), "00") & "/" & Format(FOriginal, "MMM") & "/" & Year(FOriginal) Case Is = "YYMMDD" strFechaRet = Year(FOriginal) & Format(FOriginal, "MM") & Format(Microsoft.VisualBasic.Day(FOriginal), "00") Case Is = "YYYYMMDD" strFechaRet = Year(FOriginal) & Format(FOriginal, "MM") & Format(Microsoft.VisualBasic.Day(FOriginal), "00") End Select ObtenFecha = strFechaRet End Function Public Sub sbLlenaCombo1(ByVal SQL As String, ByRef miCombo As ComboBox, ByRef ValDisplay As String) 'funcion que me permite llenar combos a traves de un procedimiento almacenado 'On Error Resume Next 'llena un combo con la sentencia SQL especificada sbConectaBD() Try miCombo.DataBindings.Clear() miCombo.DataSource = Nothing miCombo.Items.Clear() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm dt.Clear() cm.CommandTimeout = 0 ad.Fill(dt) miCombo.DataSource = dt miCombo.DisplayMember = ValDisplay miCombo.ValueMember = "clave" Catch er As Exception MessageBox.Show("Error en ClsComplejo; sbLlenaCombo1: " & er.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try sbCierraCn() End Sub Public Function ValidaCampos(ByVal strParam As String, ByVal strCHAR As String) As String Select Case UCase(strParam) Case Is = "NUMEROS" If InStr("0123456789", Mid(strCHAR, 1, 1).ToString, CompareMethod.Text) = 0 Then ValidaCampos = Nothing Else ValidaCampos = strCHAR End If End Select End Function Public Function BuscaDatos(ByVal SQL As String) As Boolean 'Dim cn2 As ExecConexion.ClassCon = New ExecConexion.ClassCon Try BuscaDatos = False ConectaBD() cm.Connection = cn cm.CommandText = SQL ad.SelectCommand = cm ad.Fill(ds) If ds.Tables(0).Rows.Count <> 0 Then BuscaDatos = True End If Catch ex As Exception MessageBox.Show("Error en ClsComplejo; BuscaDatos: ", "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Function End Try sbCierraCn() End Function 'Public Sub ReemplazaTexto(ByVal ObjWord As Word.Application, ByVal TextoIni As String, ByVal TextoFin As String) ' Try ' If ObjWord Is Nothing Then ' ObjWord = CreateObject("word.application") ' Else ' ObjWord = GetObject(, "word.application") ' End If ' ObjWord.Selection.Find.ClearFormatting() ' Dim Rp As Word.WdReplace ' Dim Wp As Word.WdFindWrap ' ObjWord.Selection.Find.ClearFormatting() ' ObjWord.Selection.Find.Replacement.ClearFormatting() ' With ObjWord.Selection.Find ' .Text = TextoIni ' .Replacement.Text = TextoFin ' .Forward = True ' .Wrap = Wp.wdFindContinue ' .Format = False ' .MatchCase = False ' .MatchWholeWord = False ' .MatchWildcards = False ' .MatchSoundsLike = False ' .MatchAllWordForms = False ' End With ' ObjWord.Selection.Find.Execute(Replace:=Rp.wdReplaceAll) ' Catch ex As Exception ' MessageBox.Show("error en ClsComplejo; sbLlenaLista: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Error) ' If Not ObjWord Is Nothing Then ' ObjWord = Nothing ' ObjWord.Documents.Close() ' ObjWord.Application.Quit() ' End If ' End Try 'End Sub Public Sub LLenaCheckLis(ByVal Chklist As CheckedListBox, ByVal SQL As String, ByVal Valordefault As Boolean) Dim Classcom As New clsComplejo Dim Classcarga As New clsComplejo Dim Fila As DataRow Classcom.fdtDataSet(SQL) If Classcom.ds.Tables(0).Rows.Count <> 0 Then For i As Integer = 0 To Classcom.ds.Tables(0).Rows.Count - 1 Fila = Nothing Fila = Classcom.ds.Tables(0).Rows(i) Chklist.Items.Add(Fila(0), Valordefault) Next End If End Sub Public Sub LLenaCheckLisESP(ByVal Chklist As CheckedListBox, ByVal SQL As String, ByVal Valordefault As Boolean, ByVal FilaIN As Integer) Dim Classcom As New clsComplejo Dim Classcarga As New clsComplejo Dim Fila As DataRow Classcom.fdtDataSet(SQL) If Classcom.ds.Tables(0).Rows.Count <> 0 Then For i As Integer = 0 To Classcom.ds.Tables(0).Rows.Count - 1 Fila = Nothing Fila = Classcom.ds.Tables(0).Rows(i) Chklist.Items.Add(Fila(FilaIN), Valordefault) Next End If End Sub Public Sub sbLimpiaControlesEsp(ByVal Forma As GroupBox) Dim lcCtrl As Object For Each lcCtrl In Forma.Controls If TypeOf lcCtrl Is TextBox Then lcCtrl.text = "" End If If TypeOf lcCtrl Is ComboBox Then lcCtrl.Selectedindex = -1 lcCtrl.text = "" 'MsgBox("limpio combo") End If If TypeOf lcCtrl Is CheckBox Then lcCtrl.Checked = False 'MsgBox("limpio chcek") End If If TypeOf lcCtrl Is DateTimePicker Then lcCtrl.value = Now End If Next lcCtrl End Sub Public Sub ColsGridAutosize(ByRef Grid As C1.Win.C1TrueDBGrid.C1TrueDBGrid) Dim i As Integer For i = 0 To Grid.Columns.Count - 1 Grid.Splits(0).DisplayColumns(i).AutoSize() Next End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub Public Function fnInserta(ByVal SQL As String) As String Try ''Ejecuta un query. Retorna en una variable el mensaje de error. Si no hay error, no retorna nada. ConectaBD() cm.Connection = cn cm.CommandText = SQL cm.ExecuteNonQuery() fnInserta = "" ''Operacion OK. Catch ex As Exception fnInserta = "Hubo un error al guardar los datos. " & vbCrLf & ex.Message End Try sbCierraCn() End Function Public Function fdtDataSetTablaESP(ByVal SQL As String) As DataSet Dim Micm As New SqlClient.SqlCommand() 'declaraciòn de comando SQL Dim Miad As New SqlClient.SqlDataAdapter() 'declaraciòn de adaptador Dim Mids As New DataSet() 'declaracion de dataset sbConectaBD() Try Micm.Connection = cn Micm.CommandText = SQL Micm.CommandTimeout = 0 Miad.SelectCommand = Micm Mids.Clear() Miad.Fill(Mids, "Tabla") Micm.Connection.Close() cn.Close() Return Mids Catch ex As Exception MessageBox.Show("Problemas al recuperar los datos, en fdtDataSetTablaESP: " & ex.Message, "MINDS", MessageBoxButtons.OK, MessageBoxIcon.Information) End Try cn.Close() End Function End Class