Cambiar datos de una clase de forma dinámica
Trades tengo una aplicación en visual.net
Tengo la siguiente clase.
public lass conexion
Private servidor As String = "Localhost"
Private basededatos As String = "Recicop"
Private usuario As String = "inser"
Private password As String = "inser"
Public Property ServidorP() As String
Get
Return servidor
End Get
Set(ByVal value As String)
servidor = value
End Set
End Property
Public Property BasededatosP() As String
Get
Return basededatos
End Get
Set(ByVal value As String)
basededatos = value
End Set
End Property
Public Property UsuarioP() As String
Get
Return usuario
End Get
Set(ByVal value As String)
usuario = value
End Set
End Property
Public Property PasswordP() As String
Get
Return password
End Get
Set(ByVal value As String)
password = value
End Set
End Property
End Class
Tengo el formulario donde utilizo la clase, es de reportes.
Public Class FrmReporteUsuarios
Dim report As New ReporteUsuarios()
Dim con As New conexion()
Private Sub FrmReporteUsuarios_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CrystalReportViewer1.ReportSource = report
report. DataSourceConnections(0). SetConnection(con. ServidorP, con. BasededatosP, con. UsuarioP, con. PasswordP)
End Sub
Private Sub FrmImprimirPedido_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
report.Dispose()
CrystalReportViewer1.Dispose()
End Sub
Lo que necesito es poder cambiar los datos de la clase conexión(servidor, base de datos, usuario, password), para poder colocar los datos del servidor, donde se instale la palicacion.
Tengo la siguiente clase.
public lass conexion
Private servidor As String = "Localhost"
Private basededatos As String = "Recicop"
Private usuario As String = "inser"
Private password As String = "inser"
Public Property ServidorP() As String
Get
Return servidor
End Get
Set(ByVal value As String)
servidor = value
End Set
End Property
Public Property BasededatosP() As String
Get
Return basededatos
End Get
Set(ByVal value As String)
basededatos = value
End Set
End Property
Public Property UsuarioP() As String
Get
Return usuario
End Get
Set(ByVal value As String)
usuario = value
End Set
End Property
Public Property PasswordP() As String
Get
Return password
End Get
Set(ByVal value As String)
password = value
End Set
End Property
End Class
Tengo el formulario donde utilizo la clase, es de reportes.
Public Class FrmReporteUsuarios
Dim report As New ReporteUsuarios()
Dim con As New conexion()
Private Sub FrmReporteUsuarios_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CrystalReportViewer1.ReportSource = report
report. DataSourceConnections(0). SetConnection(con. ServidorP, con. BasededatosP, con. UsuarioP, con. PasswordP)
End Sub
Private Sub FrmImprimirPedido_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
report.Dispose()
CrystalReportViewer1.Dispose()
End Sub
Lo que necesito es poder cambiar los datos de la clase conexión(servidor, base de datos, usuario, password), para poder colocar los datos del servidor, donde se instale la palicacion.
1 respuesta
Respuesta de Roberto Alvarado
1