I wrote some code that picks a random customer from a list of customers I import from an Excel Spreadsheet into a datagridview. Right now I am dealing with one list so it is a pretty straight forward process. However my boss wants me to adjust it so that a random employee is picked from each store (Store number is one of the fields in the datagridview).
Here is the meat of the code I have so far.
VB Code:
Dim intRandom As Integer = GetRandom(0, CInt(txtTopNumber.Text)) dgvCustomer.CurrentCell = _ dgvCustomer.Rows(intRandom).Cells(1) dgvCustomer.Rows(intRandom).Selected = True txtRandomSelectCust.Text = (CStr(dgvCustomer.Item(0, _ dgvCustomer.CurrentRow.Index).Value))
The txtTopnumber.text is a field that holds that value of the row count so I could get my upper number: txtTopNumber.Text = CStr(intRowCount). Now I need to figure multiple top numbers and select a random customer from each group of stores. I think I need a for next loop to accomplish this but I am not sure how to get started. Any help or advice will be appreciated. Here is a snap shot of the datagrid that holds the store number. (V_LASTSTOR)





Reply With Quote