WPita_MMSIS Super Contributor.
Super Contributor.
2530 views

Checkbox in DataGridView

Jump to solution

I'm needing to treat a checkbox in datagridview but I can not, can someone help me with this. Thanks!

0 Likes
3 Solutions

Accepted Solutions
Cyro_Coral Absent Member.
Absent Member.

RE: Checkbox in DataGridView

Jump to solution

Oi Pita,

Tente usar desta forma / Try to use this way:

try
    set lo-ativo to self::GridListar::Rows::Item(lo-ind)::Cells::Item(0)::Value
catch
    move spaces to lo-ativo
finally
    *> finally code
    if lo-ativo equals "True"
        *> Perform here the action you want to do.
        *> Faça aqui a ação que precisar
    end-if

Onde / Where:

lo-ativo = pic x(04) or boolean
GridListar = Nome do Objeto DataGrid / Name of the DataGrid Object
item(lo-ind) = Índice da linha / Row index
lo-ind = pic 9(03)
item(0) = Índice da coluna / Column Index

Os valores esperados são "True" quando marcado e "False" quando não estão marcados.
The values from the checkbox are "True" when checked and "False" when unchecked.

Espero que lhe ajude / Hope this helps.

Coral

0 Likes
Highlighted
Altair Absent Member.
Absent Member.

RE: Checkbox in DataGridView

Jump to solution

Oi Pita. Eu uso assim no WFA:

             method-id dataGridView1_CellContentClick final private.

             declare myChk as condition-value = type Convert::ToBoolean(dataGridView1::Rows[e::RowIndex]::Cells["NomeColuna"]::EditedFormattedValue)

             if myChk

                set dataGridView1::Columns(0)::Frozen = True

             end-if

Hi Pita, I use this in the WFA:

   method-id dataGridView1_CellContentClick final private.

             declare myChk as condition-value = type Convert::ToBoolean(dataGridView1::Rows[e::RowIndex]::Cells["Column Name"]::EditedFormattedValue)

             if myChk

                set dataGridView1::Columns(0)::Frozen = True

             end-if

0 Likes
Cyro_Coral Absent Member.
Absent Member.

RE: Checkbox in DataGridView

Jump to solution

Oi Pita, veja por favor se o exemplo em anexo responde a sua dúvida
http://community.microfocus.com/microfocus/cobol/visual_cobol/f/18/t/13125.aspx
Observação: Usa exatamente a mesma solução do Altair.

Hi Pita, please, look into the following sample to see if answers your questions.
http://community.microfocus.com/microfocus/cobol/visual_cobol/f/18/t/13125.aspx
Obs: It is using the same solution that Altair posted. 

0 Likes
7 Replies
Cyro_Coral Absent Member.
Absent Member.

RE: Checkbox in DataGridView

Jump to solution

Oi Wagner, tudo bom?

Você está trabalhando com WFA, WPF ou Asp.Net? Que tipo de ação vc precisa fazer? Está relacionado à algum evento?

Hi Wagner, how are you?

Are you working with WFA, WPF or Asp.net? What do you need to do with checkbox? is it related to an event?

0 Likes
WPita_MMSIS Super Contributor.
Super Contributor.

RE: Checkbox in DataGridView

Jump to solution

WFA - Windows Form Application

0 Likes
Cyro_Coral Absent Member.
Absent Member.

RE: Checkbox in DataGridView

Jump to solution

Oi Pita,

Tente usar desta forma / Try to use this way:

try
    set lo-ativo to self::GridListar::Rows::Item(lo-ind)::Cells::Item(0)::Value
catch
    move spaces to lo-ativo
finally
    *> finally code
    if lo-ativo equals "True"
        *> Perform here the action you want to do.
        *> Faça aqui a ação que precisar
    end-if

Onde / Where:

lo-ativo = pic x(04) or boolean
GridListar = Nome do Objeto DataGrid / Name of the DataGrid Object
item(lo-ind) = Índice da linha / Row index
lo-ind = pic 9(03)
item(0) = Índice da coluna / Column Index

Os valores esperados são "True" quando marcado e "False" quando não estão marcados.
The values from the checkbox are "True" when checked and "False" when unchecked.

Espero que lhe ajude / Hope this helps.

Coral

0 Likes
WPita_MMSIS Super Contributor.
Super Contributor.

RE: Checkbox in DataGridView

Jump to solution

Eu havia chego nesta solução com algumas poucas variações o problema e saber qual a ação para que quando eu marcar o checkbox ele por exemplo bloquei uma coluna.

0 Likes
Highlighted
Altair Absent Member.
Absent Member.

RE: Checkbox in DataGridView

Jump to solution

Oi Pita. Eu uso assim no WFA:

             method-id dataGridView1_CellContentClick final private.

             declare myChk as condition-value = type Convert::ToBoolean(dataGridView1::Rows[e::RowIndex]::Cells["NomeColuna"]::EditedFormattedValue)

             if myChk

                set dataGridView1::Columns(0)::Frozen = True

             end-if

Hi Pita, I use this in the WFA:

   method-id dataGridView1_CellContentClick final private.

             declare myChk as condition-value = type Convert::ToBoolean(dataGridView1::Rows[e::RowIndex]::Cells["Column Name"]::EditedFormattedValue)

             if myChk

                set dataGridView1::Columns(0)::Frozen = True

             end-if

0 Likes
Cyro_Coral Absent Member.
Absent Member.

RE: Checkbox in DataGridView

Jump to solution

Oi Pita, veja por favor se o exemplo em anexo responde a sua dúvida
http://community.microfocus.com/microfocus/cobol/visual_cobol/f/18/t/13125.aspx
Observação: Usa exatamente a mesma solução do Altair.

Hi Pita, please, look into the following sample to see if answers your questions.
http://community.microfocus.com/microfocus/cobol/visual_cobol/f/18/t/13125.aspx
Obs: It is using the same solution that Altair posted. 

0 Likes
WPita_MMSIS Super Contributor.
Super Contributor.

RE: Checkbox in DataGridView

Jump to solution

Pessoal obrigado pela ajuda

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.