1 Replies - 501 Views - Last Post: 08 September 2018 - 07:33 PM

#1 ahmedba   User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 220
  • Joined: 24-January 14

How to access new row in case of cell quantity selected or changed

Posted 08 September 2018 - 03:24 PM

Problem

cannot access New Row OR Last Row in case of cell quantity selected or changed .

Details

I have datagrid view have data as following

Code     Name     Quantity    Price
0101     book       1          10    selectedrow
New Row

After I Reading items By Barcode it add New Row so that some items need to change quantity for it

so that i need after change quantity from 1 to 4 as example go to cell Code in New Row or Last Row without using mouse

to be ready to receive new barcode reading .

enter key on mydatagridview send tab so that i need any thing work around or any solution when cell quantity in current row

changed or selected go to new row cell 1

can i do task above without depend on enter key or tab key ?
what i try
if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
       {
            if (GridTrxInvF.CurrentCell.ColumnIndex == 20)
            {
                SendKeys.Send("{Enter}");
                if (GridTrxInvF.EndEdit())
              {
                 e.Handled = true;
                    e.SuppressKeyPress = true;
                    var row = GridTrxInvF.Rows[GridTrxInvF.RowCount - 1];
                 if (!row.IsNewRow)
                   {
                       row = GridTrxInvF.Rows[GridTrxInvF.Rows.Add()];
                    }
                   GridTrxInvF.CurrentCell = row.Cells[1];
                    GridTrxInvF.CurrentCell.Selected = true;
                    GridTrxInvF.BeginEdit(true);
                   

               }
           }
        }


Is This A Good Question/Topic? 0
  • +

Replies To: How to access new row in case of cell quantity selected or changed

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15359
  • View blog
  • Posts: 61,590
  • Joined: 12-June 08

Re: How to access new row in case of cell quantity selected or changed

Posted 08 September 2018 - 07:33 PM

Take a step back. Why is this reading into a grid? It sounds like a handful of textboxes would be better.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1