Results 1 to 25 of 25

Thread: Randomizing and For Next Loop (Resolved)

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    259

    Randomizing and For Next Loop (Resolved)

    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:
    1. Dim intRandom As Integer = GetRandom(0, CInt(txtTopNumber.Text))
    2.  
    3.         dgvCustomer.CurrentCell = _
    4.             dgvCustomer.Rows(intRandom).Cells(1)
    5.  
    6.         dgvCustomer.Rows(intRandom).Selected = True
    7.  
    8.         txtRandomSelectCust.Text = (CStr(dgvCustomer.Item(0, _
    9.             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)

    Last edited by FastEddie; Sep 6th, 2006 at 10:07 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width