I have a GridControl in a form and a XtraUserControl
, in the event DoubleClick
of the grid I load some data to a textbox of XtraUserControl
, it brings the data correctly but it does not show them.
This is the method I use:
Public Sub CargaConsulta(ByVal id As Integer, txt As TextBox)
Dim sConex As New SqlConnection
Dim sql As String = "SELECT ComandoSql
FROM dbo.Ad_Consultas
WHERE Sec_Consulta = @id"
CadCon = Me.CadConex
sConex.ConnectionString = CadCon
Dim sqlComan As New SqlCommand(sql, sConex)
sqlComan.Parameters.AddWithValue("@id", id)
Try
sConex.Open()
Dim leer As SqlDataReader = sqlComan.ExecuteReader
If leer.Read Then
txt.Text = Convert.ToString(leer("ComandoSql"))
End If
leer.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
From here I call CargarConsulta
:
Private Sub VistaConsultas_DoubleClick(senede As Object, e As EventArgs)Handles VistaConsultas.DoubleClick
CargarConsulta(id, xtrausercontrol.txtscripsql)
End Sub
The issue is that the follow-up shows me the value that brings normal but does not load it.
Note: I've already done tests with a button to assign value with a click and it did not work either, I do not know if these controls have any kind of restrictions.