Jump to content

retomar o valor de uma datagridview num outro form


gastao
 Share

Recommended Posts

como tenho um modulo foi pacifico, vou mostrar o que fiz...

no module que tenho declarei duas variaveis

 
    Public assisf1 As Integer
    Public clief1 As Integer

no form onde existe a minha datagridview

        assisf1 = Me.DataGridView1(0, DataGridView1.CurrentRow.Index).Value
        clief1 = Me.DataGridView1(1, DataGridView1.CurrentRow.Index).Value

        Dim tec As New tecnica
        tec.ShowDialog()

no form chamado para onde irei usar as variaveis basta ir buscar as variaveis e usar

exemplo:

If clief1 <> 0 Then
            Call dados()
            If consql.State = ConnectionState.Open Then consql.Close()
            'dar o Id consoante o numero do cliente
            consql.Open()
            Dim cmd As New SqlCommand("select * from tb_clientes where id_cliente = '" & clief1 & "'", consql)
            Dim drdr As SqlDataReader
            drdr = cmd.ExecuteReader
            drdr.Read()
            clief1 = drdr.Item("id_cliente")
            consql.Close()
           ...

obrigado caça pela dica

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.