Question

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 about 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
    }
}
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top