error when BO is empty


Author
Message
Felix M Avendano
Felix M Avendano
StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)StrataFrame Novice (88 reputation)
Group: Forum Members
Posts: 48, Visits: 1.5K
I have a form with 2 comboboxes, one datagrid, 3 BO's and one BBS. The Bo's are related between them in a father, child, grandchild relationship. The BBS is attached to the datagrid. The datagrid receives the data of the grandchild.

I have the code that follows in the form:

Public Class frmTrabajoseinsumos


    Private Sub ComboBox2_ListPopulating(ByVal e As MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles ComboBox2.ListPopulating
        If Me.BoEmpresa1.Count > 0 Then
            e.Parameters(0).Value = CInt(ComboBox1.SelectedValue)
        Else
            e.Parameters(0).Value = 0
        End If

    End Sub

    Private Sub ComboBox1_ParentFormLoading() Handles ComboBox1.ParentFormLoading
        Me.BoEmpresa1.FillAll()
    End Sub


    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If (CInt(ComboBox1.SelectedValue)) > 0 Then
            BoTipotrabajoinsumo1.FillByCustomPK(CInt(ComboBox1.SelectedValue))
            ComboBox2.Requery()

        End If
        If Me.BoTrabajoinsumo1.Count > 0 Then
            BoTrabajoinsumo1.FillByCustomPK(CInt(ComboBox1.SelectedValue), CInt(ComboBox2.SelectedValue))
        End If
    End Sub


    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        'If Me.BoTrabajoinsumo1.Count > 0 Then
        BoTrabajoinsumo1.FillByCustomPK(CInt(ComboBox1.SelectedValue), CInt(ComboBox2.SelectedValue))
        DataGridView1.Refresh()


    End Sub

End Class

The problem cames in the last ComboBox2_SelectedIndexChanged. When the query of the FillByCustomPK cames with no data and the BO is empty I get the following error:

The CurrentRow for table '[dbo].[Trabajoinsumo]' could not be evaluated because the CurrentRowIndex is out of range.  Business object record count: 0.  CurrentRowIndex: -1.

The error is launched in a part of the generated code:

''' <summary>
    ''' Tipoactividad
    ''' </summary>
    <Browsable(False), _
     BusinessFieldDisplayInEditor(), _
     Description("Tipoactividad"), _
     DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property [Tipoactividad]() As System.Int32
        Get
            Return CType(Me.CurrentRow.Item("Tipoactividad"), System.Int32)
        End Get
        Set(ByVal value As System.Int32)
            Me.CurrentRow.Item("Tipoactividad") = value
        End Set
    End Property

Ive being trying to do my best but I cant find a solution in order to avoid the error, unless I change the generated code, and that's awfol.

Any Sugestion wil be well received.

Replies
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
That problem was fixed in the latest version 1.7.0.2, download it from your account and you should be good.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Yup, please download the most recent build and see if your problem persists. Thanks.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search