Foros del Web » Programación para mayores de 30 ;) » .NET »

[SOLUCIONADO] Mostrar datos en varios textbox desde capa acceso datos

Estas en el tema de Mostrar datos en varios textbox desde capa acceso datos en el foro de .NET en Foros del Web. Buenos días estoy intentado cargar los datos de un filtro(desde procedimiento almacenado) a varios textbox. Estoy desarrollando en vb .net con mysql: Procedimiento almacenado "Filtra_Vehi_PorId" ...
  #1 (permalink)  
Antiguo 09/09/2014, 15:27
Avatar de junior1920  
Fecha de Ingreso: noviembre-2010
Ubicación: Tumán
Mensajes: 77
Antigüedad: 13 años, 5 meses
Puntos: 1
Mostrar datos en varios textbox desde capa acceso datos

Buenos días estoy intentado cargar los datos de un filtro(desde procedimiento almacenado) a varios textbox. Estoy desarrollando en vb .net con mysql:

Procedimiento almacenado "Filtra_Vehi_PorId"
Código MySQL:
Ver original
  1. DROP PROCEDURE `Filtra_Vehi_PorId`;
  2. CREATE DEFINER=`root`@`localhost` PROCEDURE `Filtra_Vehi_PorId`(IN `idenviado` INT) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER
  3. SELECT v.idv,v.numplaca,m.serie,ma.nommarca,e.tipoestado,v.kmcompra, v.kmactual FROM vehiculo v INNER JOIN motor m on m.idmotor=v.idmotor INNER JOIN marca ma on ma.idmarca=v.idmarca INNER JOIN estado e on e.idestado= v.idestado WHERE v.idv=idenviado;

Ahora Capa de Datos "VehículoAD"
Código vb:
Ver original
  1. Imports MySql.Data.MySqlClient
  2. Imports System.Data.SqlTypes
  3. Imports ENTIDAD
  4. Public Class VehiculoAD
  5.     Private conn As New MySqlConnection  'SqlConnection
  6.    Private conn1 As New MySqlConnection 'SqlConnection
  7.    Private comando As New MySqlCommand 'SqlCommand
  8.  
  9. #Region "Cadena de conexion"
  10.     Public Sub New()
  11.         Dim Objconexion As New ConexionAD
  12.         conn = Objconexion.abrir
  13.         comando.Connection = conn
  14.     End Sub
  15. #End Region
  16.  
  17. #Region "Función convertir datos"
  18.     Private Shared Function ConvertirdatosVehiSalEn(ByVal reader As IDataReader) As VehiculoEN
  19.         Dim vehiculo As New VehiculoEN
  20.         vehiculo.idv = LTrim(RTrim(Convert.ToInt32(reader(0))))
  21.         vehiculo.numplaca = LTrim(RTrim(Convert.ToString(reader(1))))
  22.         Dim ObjMotor = New MotorEN((reader(2)))
  23.         vehiculo.idmotor = ObjMotor.serie
  24.         Dim ObjMarca = New MarcaEN((reader(3)))
  25.         vehiculo.idmarca = ObjMarca.nommarca
  26.         vehiculo.idestado = LTrim(RTrim(Convert.ToString(reader(4))))
  27.         vehiculo.kmcompra = LTrim(RTrim(Convert.ToDecimal(reader(5))))
  28.         vehiculo.kmactual = LTrim(RTrim(Convert.ToDecimal(reader(6))))
  29.         Return vehiculo
  30.     End Function
  31. #End Region
  32.  
  33. #Region "Función Filtra_Vehi_PorId"
  34.     Public Function Filtra_Vehi_PorId(ByVal ObjVehiculoEN As VehiculoEN) As List(Of VehiculoEN)
  35.         Dim list As New List(Of VehiculoEN)
  36.         Dim reader As MySqlDataReader
  37.         Try
  38.             comando.CommandType = CommandType.StoredProcedure
  39.             comando.CommandText = "Filtra_Vehi_PorId"
  40.             Dim _idenviado As New MySqlParameter("idenviado", MySqlDbType.Int32)
  41.             _idenviado.Value = ObjVehiculoEN.idv
  42.             _idenviado.Direction = ParameterDirection.Input
  43.             comando.Parameters.Add(_idenviado)
  44.             reader = comando.ExecuteReader
  45.             While reader.Read
  46.                 list.Add(ConvertirdatosVehiSalEn(reader))
  47.             End While
  48.             Return list
  49.         Catch ex As Exception
  50.             MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source)
  51.         Finally
  52.             conn.Close()
  53.             conn.ClearAllPools()
  54.             conn = Nothing
  55.         End Try
  56.     End Function
  57. #End Region

La capa Entidad no la incluyo porque ya se sabe.
Ahora la capa Lógica de negocio "VehiculoLN"
Código vb:
Ver original
  1. Imports ENTIDAD
  2. Imports ACCESO_DATOS
  3. Public Class VehiculoLN
  4.     Private ObjVehiculoAD As VehiculoAD
  5.     Public Sub New()
  6.         ObjVehiculoAD = New VehiculoAD
  7.     End Sub
  8.  
  9. #Region "Establecer conexion con la función Filtra_Vehi_PorId"
  10.     Public Function Filtra_Vehi_PorId(ByVal ObjVehiculoEN As VehiculoEN) As List(Of VehiculoEN)
  11.         Return ObjVehiculoAD.Filtra_Vehi_PorId(ObjVehiculoEN)
  12.     End Function
  13. #End Region

Ahora la capa presentación "ListaVehíSalidasEntradas": Bueno primero cargo un pequeño listado en un datagridview donde incluyo los fk de las tablas reelacionadas los cuales oculto en las columnas; luego al seleccionar un registro me envia un id esto hace que el procedimiento me filtre el registro y me muestre los datos que requiero.

Formulario "ListaVehiSalEntVehi"
Código vb:
Ver original
  1. Imports ENTIDAD
  2. Imports LOGICA_NEGOCIO
  3. Imports System.IO
  4. Imports System.Drawing
  5. Imports Helpers
  6. Public Class FrmListaSalEntVehi
  7.     Private ObjRegistro_Reco_VehiEN As Registro_Reco_VehiEN
  8.     Private ObjRegistro_Reco_VehiLN As Registro_Reco_VehiLN
  9.  
  10.     Sub FormatoDgv()
  11.         Me.DgvListaRecorVehi.DefaultCellStyle.NullValue = "no entry"
  12.         With Me.DgvListaRecorVehi
  13.             .Columns(1).Visible = False
  14.             .Columns(2).Visible = False
  15.             .Columns(7).DefaultCellStyle.Format = "t"
  16.             .Columns(9).DefaultCellStyle.Format = "t"
  17.         End With
  18.     End Sub
  19.  
  20. #Region "Modificador de acceso para cargar el listado"
  21.     Public Sub CargarListaRecorVehi()
  22.         Try
  23.             ObjRegistro_Reco_VehiEN = New Registro_Reco_VehiEN
  24.             ObjRegistro_Reco_VehiLN = New Registro_Reco_VehiLN
  25.             DgvListaRecorVehi.AutoGenerateColumns = False
  26.             FormatoDgv()
  27.             DgvListaRecorVehi.DataSource = ObjRegistro_Reco_VehiLN.Lista_Recor_Vehi()
  28.             LblTotalRegistros.Text = "Total de registros" + " " + CStr(DgvListaRecorVehi.Rows.Count)
  29.         Catch ex As Exception
  30.             MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source)
  31.         End Try
  32.     End Sub
  33. #End Region
  34.     Private Sub FrmListaSalEntVehi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  35.         CargarListaRecorVehi()
  36.     End Sub
  37.  Private Sub BtnModificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnModificar.Click
  38.         If (CStr(DgvListaRecorVehi.Rows.Count) <= 0) Then
  39.             MsgBox("Al menos Debes de registrar una salida de vehículo para poder registrar llegada", MsgBoxStyle.Information, "Mensaje")
  40.             Exit Sub
  41.         End If
  42.  
  43.         If (TxtCapturaId.Text = "") Then
  44.             MsgBox("Seleccione 1 registro para registrar llegada del vehículo", MsgBoxStyle.Information, "Mensaje")
  45.             Exit Sub
  46.         End If
  47.         Dim FormRegEntVehi As FrmRegEntVehi
  48.         FormRegEntVehi = New FrmRegEntVehi(Me)
  49.         FormRegEntVehi.ShowDialog()
  50.         FormRegEntVehi = Nothing
  51.  
  52.     End Sub
  53.  
  54.     Private Sub DgvListaRecorVehi_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgvListaRecorVehi.CellClick
  55.         If (Convert.ToInt32(DgvListaRecorVehi.Rows.Count) >= 1) Then
  56.             For Each d As DataGridViewRow In Me.DgvListaRecorVehi.SelectedRows
  57.                 TxtCapturaId.Text = d.Cells(0).Value
  58.             Next
  59.         End If
  60.     End Sub

Luego en un formulario Modal capturo el id como les comente líneas más arriba para que mi procedimiento me filtre lo que requiero mostrar todo bien filtra el procedimiento funca hasta en la capa AccesoDatos en las variables me muestra los datos que el procedimiento filtra. Ahora lo que no puedo hacer hasta el momento es que esos datos me muestre en cada textbox. Aquí esta el código:

Código vb:
Ver original
  1. Imports ENTIDAD
  2. Imports LOGICA_NEGOCIO
  3. Imports System.IO
  4. Imports System.Drawing
  5. Imports Helpers
  6. Public Class FrmRegEntVehi
  7.     Dim FormListaSalEntVehi As FrmListaSalEntVehi
  8.     Public Sub New(ByVal _FormListaSalEntVehi As FrmListaSalEntVehi)
  9.         ' The Me.InitializeComponent call is required for Windows Forms designer support.
  10.        FormListaSalEntVehi = _FormListaSalEntVehi
  11.         Me.InitializeComponent()
  12.  
  13.         '
  14.        ' TODO : Add constructor code after InitializeComponents
  15.        ''
  16.    End Sub
  17.     Private ObjRegistro_Reco_VehiEN As Registro_Reco_VehiEN
  18.     Private ObjRegistro_Reco_VehiLN As Registro_Reco_VehiLN
  19.  
  20.     Private ObjVehiculoEN As VehiculoEN
  21.     Private ObjVehiculoLN As VehiculoLN
  22.  
  23.     Private ObjPolizaEN As PolizaEN
  24.     Private ObjPolizaLN As PolizaLN
  25.     Private x As Integer
  26.  
  27.     Private Sub FrmRegEntVehi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  28.         x = FormListaSalEntVehi.TxtCapturaId.Text
  29.         LblFechaSys.Text = Date.Today
  30.         LblHora.Text = Date.Now.ToLongTimeString
  31.         For Each d As DataGridViewRow In FormListaSalEntVehi.DgvListaRecorVehi.SelectedRows
  32.             'TxtCodigo.Text = d.Cells(0).Value
  33.            TxtIdV.Text = d.Cells(1).Value
  34.         Next
  35.     End Sub
  36. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  37.         LblHora.Text = Date.Now.ToLongTimeString
  38.     End Sub
  39.  
  40. 'Estoy codificando en el textchange del textbox donde capturo el id del vehiculo pero no logro hacer que cada text se enlace a cada campo
  41.  
  42.     Private Sub TxtIdV_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtIdV.TextChanged
  43.         Try
  44.             ObjVehiculoEN = New VehiculoEN
  45.             ObjVehiculoLN = New VehiculoLN
  46.             ObjVehiculoEN.idv = LTrim(RTrim(TxtIdV.Text))
  47.             Dim datos As New List(Of VehiculoEN)
  48.             datos = ObjVehiculoLN.Filtra_Vehi_PorId(ObjVehiculoEN)
  49.             While datos.Count
  50.                 TxtNumPlaca.Text = datos(1).numplaca
  51.                 TxtIdMotor.Text = datos(2).idmotor
  52.                 TxtMarca.Text = datos(3).idmarca
  53.                 TxtEstado.Text = datos(4).idestado
  54.                 TxtKmCompra.Text = datos(5).kmcompra
  55.                 TxtkmInicial.Text = datos(6).kmactual
  56.             End While
  57.  
  58.         Catch ex As Exception
  59.             MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source)
  60.         End Try
  61.     End Sub

Espero de sus consejos. Gracias.
  #2 (permalink)  
Antiguo 10/09/2014, 10:20
Avatar de junior1920  
Fecha de Ingreso: noviembre-2010
Ubicación: Tumán
Mensajes: 77
Antigüedad: 13 años, 5 meses
Puntos: 1
Respuesta: Mostrar datos en varios textbox desde capa acceso datos

Me ayudaron a solucionarlo. Lo que hice fue que al filtrar me envíe la la entidad y no el listado.

Ahora Capa de Datos "VehículoAD"
Código vb:
Ver original
  1. Imports MySql.Data.MySqlClient
  2. Imports System.Data.SqlTypes
  3. Imports ENTIDAD
  4. Public Class VehiculoAD
  5.     Private conn As New MySqlConnection  'SqlConnection
  6.    Private conn1 As New MySqlConnection 'SqlConnection
  7.    Private comando As New MySqlCommand 'SqlCommand
  8.  
  9. #Region "Cadena de conexion"
  10.     Public Sub New()
  11.         Dim Objconexion As New ConexionAD
  12.         conn = Objconexion.abrir
  13.         comando.Connection = conn
  14.     End Sub
  15. #End Region
  16.  
  17. #Region "Función Filtra_Vehi_PorId"
  18.     Public Function Filtra_Vehi_PorId(ByVal ObjVehiculoEN As VehiculoEN) As VehiculoEN
  19.         Dim reader As MySqlDataReader
  20.         Try
  21.             comando.CommandType = CommandType.StoredProcedure
  22.             comando.CommandText = "Filtra_Vehi_PorId"
  23.             Dim _idenviado As New MySqlParameter("idenviado", MySqlDbType.Int32)
  24.             _idenviado.Value = ObjVehiculoEN.idv
  25.             _idenviado.Direction = ParameterDirection.Input
  26.             comando.Parameters.Add(_idenviado)
  27.             reader = comando.ExecuteReader
  28.             Dim vehiculo As New VehiculoEN
  29.             While reader.Read
  30.  
  31.  
  32.             End While
  33.             Return list
  34.         Catch ex As Exception
  35.             MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source)
  36.         Finally
  37.             conn.Close()
  38.             conn.ClearAllPools()
  39.             conn = Nothing
  40.         End Try
  41.     End Function
  42. #End Region
  #3 (permalink)  
Antiguo 10/09/2014, 10:27
Avatar de junior1920  
Fecha de Ingreso: noviembre-2010
Ubicación: Tumán
Mensajes: 77
Antigüedad: 13 años, 5 meses
Puntos: 1
Respuesta: Mostrar datos en varios textbox desde capa acceso datos

Con ayuda lo pude solucionar. La solución fue que en lugar de que me devuelva un listado me devuelva la entidad. Aquí las modificaciones:
Código vb:
Ver original
  1. Imports MySql.Data.MySqlClient
  2. Imports System.Data.SqlTypes
  3. Imports ENTIDAD
  4. Public Class VehiculoAD
  5.     Private conn As New MySqlConnection  'SqlConnection
  6.    Private conn1 As New MySqlConnection 'SqlConnection
  7.    Private comando As New MySqlCommand 'SqlCommand
  8.  
  9. #Region "Cadena de conexion"
  10.     Public Sub New()
  11.         Dim Objconexion As New ConexionAD
  12.         conn = Objconexion.abrir
  13.         comando.Connection = conn
  14.     End Sub
  15. #End Region
  16.  
  17. #Region "Función Filtra_Vehi_PorId"
  18.     Public Function Filtra_Vehi_PorId(ByVal ObjVehiculoEN As VehiculoEN) As VehiculoEN
  19.         Dim reader As MySqlDataReader
  20.         Try
  21.             comando.CommandType = CommandType.StoredProcedure
  22.             comando.CommandText = "Filtra_Vehi_PorId"
  23.             Dim _idenviado As New MySqlParameter("idenviado", MySqlDbType.Int32)
  24.             _idenviado.Value = ObjVehiculoEN.idv
  25.             _idenviado.Direction = ParameterDirection.Input
  26.             comando.Parameters.Add(_idenviado)
  27.             reader = comando.ExecuteReader
  28.             Dim vehiculo As New VehiculoEN
  29.             While reader.Read
  30.                 vehiculo.idv = LTrim(RTrim(Convert.ToInt32(reader(0))))
  31.                 vehiculo.numplaca = LTrim(RTrim(Convert.ToString(reader(1))))
  32.                 Dim ObjMotor = New MotorEN((reader(2)))
  33.                 vehiculo.idmotor = ObjMotor.serie
  34.                 Dim ObjMarca = New MarcaEN((reader(3)))
  35.                 vehiculo.idmarca = ObjMarca.nommarca
  36.                 vehiculo.idestado = LTrim(RTrim(Convert.ToString(reader(4))))
  37.                 vehiculo.kmcompra = LTrim(RTrim(Convert.ToDecimal(reader(5))))
  38.                 vehiculo.kmactual = LTrim(RTrim(Convert.ToDecimal(reader(6))))
  39.             End While
  40.             Return list
  41.         Catch ex As Exception
  42.             MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source)
  43.         Finally
  44.             conn.Close()
  45.             conn.ClearAllPools()
  46.             conn = Nothing
  47.         End Try
  48.     End Function
  49. #End Region

La capa Entidad no la incluyo porque ya se sabe.
Ahora la capa Lógica de negocio "VehiculoLN"
Código vb:
Ver original
  1. Imports ENTIDAD
  2. Imports ACCESO_DATOS
  3. Public Class VehiculoLN
  4.     Private ObjVehiculoAD As VehiculoAD
  5.     Public Sub New()
  6.         ObjVehiculoAD = New VehiculoAD
  7.     End Sub
  8.  
  9. #Region "Establecer conexion con la función Filtra_Vehi_PorId"
  10.     Public Function Filtra_Vehi_PorId(ByVal ObjVehiculoEN As VehiculoEN) As VehiculoEN
  11.         Return ObjVehiculoAD.Filtra_Vehi_PorId(ObjVehiculoEN)
  12.     End Function
  13. #End Region

Ahora la capa presentación "ListaVehíSalidasEntradas": Bueno primero cargo un pequeño listado en un datagridview donde incluyo los fk de las tablas reelacionadas los cuales oculto en las columnas; luego al seleccionar un registro me envia un id esto hace que el procedimiento me filtre el registro y me muestre los datos que requiero.

Formulario "ListaVehiSalEntVehi"
Código vb:
Ver original
  1. Imports ENTIDAD
  2. Imports LOGICA_NEGOCIO
  3. Imports System.IO
  4. Imports System.Drawing
  5. Imports Helpers
  6. Public Class FrmListaSalEntVehi
  7.     Private ObjRegistro_Reco_VehiEN As Registro_Reco_VehiEN
  8.     Private ObjRegistro_Reco_VehiLN As Registro_Reco_VehiLN
  9.  
  10.     Sub FormatoDgv()
  11.         Me.DgvListaRecorVehi.DefaultCellStyle.NullValue = "no entry"
  12.         With Me.DgvListaRecorVehi
  13.             .Columns(1).Visible = False
  14.             .Columns(2).Visible = False
  15.             .Columns(7).DefaultCellStyle.Format = "t"
  16.             .Columns(9).DefaultCellStyle.Format = "t"
  17.         End With
  18.     End Sub
  19.  
  20. #Region "Modificador de acceso para cargar el listado"
  21.     Public Sub CargarListaRecorVehi()
  22.         Try
  23.             ObjRegistro_Reco_VehiEN = New Registro_Reco_VehiEN
  24.             ObjRegistro_Reco_VehiLN = New Registro_Reco_VehiLN
  25.             DgvListaRecorVehi.AutoGenerateColumns = False
  26.             FormatoDgv()
  27.             DgvListaRecorVehi.DataSource = ObjRegistro_Reco_VehiLN.Lista_Recor_Vehi()
  28.             LblTotalRegistros.Text = "Total de registros" + " " + CStr(DgvListaRecorVehi.Rows.Count)
  29.         Catch ex As Exception
  30.             MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source)
  31.         End Try
  32.     End Sub
  33. #End Region
  34.     Private Sub FrmListaSalEntVehi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  35.         CargarListaRecorVehi()
  36.     End Sub
  37.  Private Sub BtnModificar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnModificar.Click
  38.         If (CStr(DgvListaRecorVehi.Rows.Count) <= 0) Then
  39.             MsgBox("Al menos Debes de registrar una salida de vehículo para poder registrar llegada", MsgBoxStyle.Information, "Mensaje")
  40.             Exit Sub
  41.         End If
  42.  
  43.         If (TxtCapturaId.Text = "") Then
  44.             MsgBox("Seleccione 1 registro para registrar llegada del vehículo", MsgBoxStyle.Information, "Mensaje")
  45.             Exit Sub
  46.         End If
  47.         Dim FormRegEntVehi As FrmRegEntVehi
  48.         FormRegEntVehi = New FrmRegEntVehi(Me)
  49.         FormRegEntVehi.ShowDialog()
  50.         FormRegEntVehi = Nothing
  51.  
  52.     End Sub
  53.  
  54.     Private Sub DgvListaRecorVehi_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgvListaRecorVehi.CellClick
  55.         If (Convert.ToInt32(DgvListaRecorVehi.Rows.Count) >= 1) Then
  56.             For Each d As DataGridViewRow In Me.DgvListaRecorVehi.SelectedRows
  57.                 TxtCapturaId.Text = d.Cells(0).Value
  58.             Next
  59.         End If
  60.     End Sub

Luego en un formulario Modal capturo el id como les comente líneas más arriba para que mi procedimiento me filtre lo que requiero mostrar todo bien filtra el procedimiento funca hasta en la capa AccesoDatos en las variables me muestra los datos que el procedimiento filtra. Ahora lo que no puedo hacer hasta el momento es que esos datos me muestre en cada textbox. Aquí esta el código:
Código vb:
Ver original
  1. Imports ENTIDAD
  2. Imports LOGICA_NEGOCIO
  3. Imports System.IO
  4. Imports System.Drawing
  5. Imports Helpers
  6. Public Class FrmRegEntVehi
  7.     Dim FormListaSalEntVehi As FrmListaSalEntVehi
  8.     Public Sub New(ByVal _FormListaSalEntVehi As FrmListaSalEntVehi)
  9.         ' The Me.InitializeComponent call is required for Windows Forms designer support.
  10.        FormListaSalEntVehi = _FormListaSalEntVehi
  11.         Me.InitializeComponent()
  12.  
  13.         '
  14.        ' TODO : Add constructor code after InitializeComponents
  15.        ''
  16.    End Sub
  17.     Private ObjRegistro_Reco_VehiEN As Registro_Reco_VehiEN
  18.     Private ObjRegistro_Reco_VehiLN As Registro_Reco_VehiLN
  19.  
  20.     Private ObjVehiculoEN As VehiculoEN
  21.     Private ObjVehiculoLN As VehiculoLN
  22.  
  23.     Private ObjPolizaEN As PolizaEN
  24.     Private ObjPolizaLN As PolizaLN
  25.     Private x As Integer
  26.  
  27.     Private Sub FrmRegEntVehi_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  28.         x = FormListaSalEntVehi.TxtCapturaId.Text
  29.         LblFechaSys.Text = Date.Today
  30.         LblHora.Text = Date.Now.ToLongTimeString
  31.         For Each d As DataGridViewRow In FormListaSalEntVehi.DgvListaRecorVehi.SelectedRows
  32.             'TxtCodigo.Text = d.Cells(0).Value
  33.            TxtIdV.Text = d.Cells(1).Value
  34.         Next
  35.     End Sub
  36. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  37.         LblHora.Text = Date.Now.ToLongTimeString
  38.     End Sub
  39.  
  40. 'Estoy codificando en el textchange del textbox donde capturo el id del vehiculo pero no logro hacer que cada text se enlace a cada campo
  41.  
  42.     Private Sub TxtIdV_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtIdV.TextChanged
  43.         Try
  44.             ObjVehiculoEN = New VehiculoEN
  45.             ObjVehiculoLN = New VehiculoLN
  46.             ObjVehiculoEN.idv = LTrim(RTrim(TxtIdV.Text))
  47.             Dim datos As VehiculoEN= ObjVehiculoLN.Filtra_Vehi_PorId(ObjVehiculoEN)
  48.             Dim i as Integer=0
  49.                 i=datos(0).idv
  50.                 TxtNumPlaca.Text = datos(1).numplaca
  51.                 TxtIdMotor.Text = datos(2).idmotor
  52.                 TxtMarca.Text = datos(3).idmarca
  53.                 TxtEstado.Text = datos(4).idestado
  54.                 TxtKmCompra.Text = datos(5).kmcompra
  55.                 TxtkmInicial.Text = datos(6).kmactual
  56.         Catch ex As Exception
  57.             MsgBox(ex.Message, MsgBoxStyle.Critical, ex.Source)
  58.         End Try
  59.     End Sub

Última edición por junior1920; 10/09/2014 a las 10:33

Etiquetas: mysql, net, sql, textbox
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:10.