开发者

On line break event

开发者 https://www.devze.com 2023-03-01 01:32 出处:网络
I\'m working on a project involving data entry. The table looks like this : dateTime , enum, text, enum, val1, val2, text, enum;

I'm working on a project involving data entry.

The table looks like this : dateTime , enum, text, enum, val1, val2, text, enum;

All values apart from val1 and val2 are entered only once and are added to the table for each val1 val2 pair. Val1 and val2 are different for each row entry, they're both barcodes.

I'm looking to make it as efficient as possible so I'd like to know if there is a way to make the DGV update when Val1/2 have been entered ( the rest of the vals are currently stored as vars in an object[] ). I'm using a standard barcode scanner so I though I could make it enter the values on the "linebreak" the scanner enters after scanning the barcode so I'm basically looking for the "scanner_LineBreak" event or something...

So I've gotten beyond that problem... now.... I need to write the all the data to a text/excel/xml/whichevertheheck file from the DGV... bad structuring I know... might just start over. Any way, I've created an empty dataset , and empty datatable and an empty datarow (using the object[] fill the row which fills the table which fills the set) and I'm now attempting to input all the data to the empty dataTable so I can add it to the dataset so I can write the data to XML . needless to say it's not working. I tried using the XmlSerializer but it errors when I import it to Access and/or IE . So going back to square 1... Is there a way to populate a DS from a DGV or is there a way to write whichever document using only DGV data. note: DGV = DataGridView

UPDATE

After thinking ab开发者_开发问答out it for a while I realized that I could make a counter increment for every character entered with the Textchanged event and from there do what I'd wanted ... go figure...

int counter = 0;
private void textbox1_Textchanged(obj sender etc)
{
    counter++;

    if (counter % 10 == 0)
    {
        //shift focus to other textbox then do same to "save" values
    }
}


In my experience, most bar code scanners are treated as keyboard input. The numbers will come in followed by a control character (usually CRLF or tab but you will need to check with your scanner to see what character it is using). You can then use the KeyDown or TextChanged events to look at the input and if it is the control character perform your updating logic.

0

精彩评论

暂无评论...
验证码 换一张
取 消