mardi 13 novembre 2018

Sandwich application with inventory

I am to the point in my application where I need to create an inventory sheet in my windows form in visual basic and have it link to my order form and allow the order form to make sure that there is enough inventory to create the sandwich and also have the inventory modified every time there are ingredients used. I know that databases can be modified but I don't know if a database would be the best decision because I would need to do math in the code. And a text file would be hard to modify i would assume. Pretty much other than a database, I don't have a clue how you can create an modifiable inventory that looks like an imported page. I have been playing around with the idea in my head about making the inventory page just consist of labels with the description of the product and text boxes with the amount left and group them all in a groupbox. And then in the inventory source code I could do this:

`foreach (var checkBox in ctrl .Controls .OfType<CheckBox>())
    {
        Total = checkBox .Checked? (Total + Convert .ToDouble(checkBox .Tag)) : Total;}`

except I am not getting how to connect the inventory amounts on the inventory page to the checkboxes that I have . Say I have a checkbox and its called roast beef. and i check the box. now I have to get the text from the checkbox and compare it to the variable for the inventory nin the other class.

selection = checkbox.Text; foreach (var item in inventoryGroupBox) {if ( item == selection) if ( selection >= item) total += itemPrice;}

I hope this is making sense. I am at a stand still and I cant seem to type the right thing into google to even find a way to add a page to a form. Am i going in the right direction?




Aucun commentaire:

Enregistrer un commentaire