Hey guys!

Im making a orders system, I want to add a product individually into the datagrid,for example:

If I add for example 5 gl of milk it will display like this:

Quantity  Description
   5       GL Milk

  But I want it to display it like this:

  Quantity  Description
      1      GL Milk
      1      GL Milk
      1      GL Milk
      1      GL Milk
      1      GL Milk

I want to display the product in the datagrid the amount I entered in the quantity box.Do I have to make a loop?

Recommended Answers

All 2 Replies

You'll probably need a For Loop, For I= 1 to Quantity, then add a row in the loop, so that you get the same number of rows added as the quantity

Yeah, tinstaafl was right. Using FOR LOOP is the best way to do it.

For i as integer = 1 to 5

    'Your code here

Next

'You can specify the range if you want, like:
'
'For i as integer = 1 to cint(txtDesc.text)

Hope this help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.