Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Check if Grid Returns Records.?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Resolved [RESOLVED] [2005] Check if Grid Returns Records.?

    I have a Combobox Bound to a dataset, and a datagrid that is located on a control in the form i'm working on. If the combo Box is set to Enrolled and the datagrid is Empty, when I click save i want to exit the sub of that click event.

    How do I check if there are any rows in a datagrid?



    Further explanation:

    The combobox is filled with status codes. The user should not be able to pick Enrolled if the datagrid is empty. The datagrid being bound to an employee table. Basically if the employer has no employees we cannot enroll them. Or the user should not be able to give them enrolled status..
    Tuber

    "I don't know the rules"

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Re: [2005] Check if Grid Returns Records.?

    Code:
       Try
                If ComboBox9.Text = "ENR-P" And ctlCall.DsCall1.Tables("Call").Rows.Count = 0 Then
                    Exit Sub
                End If
            Catch ex As Exception
    
            End Try

    My problem is getting the data from the grid when it's contained in the control
    Tuber

    "I don't know the rules"

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Iowa
    Posts
    298

    Re: [2005] Check if Grid Returns Records.?

    Send Boolean Values to your form from the control

    Code:
    Try
                If Me.DsEmployee1.Tables("Employee").Rows.Count = 0 Then
                    frmClient.blEmployees = False
                Else : frmClient.blEmployees = True
                End If
            Catch ex As Exception
    
            End Try
    Then Evaluate


    Code:
     If Me.blEmployees = False And ComboBox9.Text = "ENR-P" Then
                MsgBox("Status of 'ENR-P' Not Allowed: No Employees", MsgBoxStyle.OkOnly, "Oops!")
                Exit Sub
            End If
    Tuber

    "I don't know the rules"

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