Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error in DBGrid (VB6 SP5; True DBGrid Pro 5.0)

    Hi,

    I have a form where data is entered for a new client onto DBGrid (using Unbound mode with associated coding from the help). There could be any number of entries on the screen, so I've created the grid with 13 blank rows to start off with, which I increment if necessary.

    My big problem is that if a user clicks on the blank part of the grid, I get the error "6148 Invalid Row Number", in the UnboundWriteData for the grid. If I try to trap that error, and bypass the code, I get other errors firther on. I cannot find anything which stops this error, or which bypasses it. I've been told to solve this quickly- any ideas please?



    <pre>Private Sub gridSubject_UnboundWriteData( _
    ByVal RowBuf As TrueDBGrid50.RowBuffer, WriteLocation As Variant)

    ' The UnboundWriteData event is fired when the user
    ' modifies an existing row within an unbound grid and
    ' attempts to commit the changes by moving to another
    ' row or calling the Update method of the grid.
    Dim I As Integer

    For I = 0 To RowBuf.ColumnCount - 1
    If Not IsNull(RowBuf.Value(0, I)) Then
    <font color=red> If Not StoreUserData(WriteLocation, I, RowBuf.Value(0, I)) Then</font color=red>
    RowBuf.RowCount = 0
    Exit Sub
    End If
    End If
    Next I

    End Sub</pre>

    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error in DBGrid (VB6 SP5; True DBGrid Pro 5.0)

    Geoff,

    I have no idea what the DBGrid objects do, but by looking over your code I offer this:

    What is the row number that it thinks is invalid? Is it 0 (zero)?

    Seems to me you've got to keep the StoreUserData function from executing if the grid row is blank. Can you test for that?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Error in DBGrid (VB6 SP5; True DBGrid Pro 5.0)

    Geoff,

    Is that the Apex control? I haven't used it and don't have the documentation for it, but If the SelChange event occurs when a row or column is deselected, could you use that to trap the problem before it gets to the UnboundWriteData event?
    Charlotte

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error in DBGrid (VB6 SP5; True DBGrid Pro 5.0)

    Charlotte,

    Yes, that is the Apex control.

    Thanks for the thought- but the UnboundWriteData occurs before the selChange. I think it's triggred by the grid Update event- which pushes data from the grid into an internal array which holds a copy of all the data.

    The code which came with the control is very messy. If I'd had my druthers, I would have done it all a different way. Too late now.

    The code which gets executed in StoreUserData, which is called from this event, seems vital. If I bypass the UnboundWrite stuff, and don't execute what';s in SToreUserData, I get errors later on.

    Thanks for the input.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error in DBGrid (VB6 SP5; True DBGrid Pro 5.0)

    Kevin,

    I is zero when this falls over- but the row number is the rownumber of the RowBuf object. I don't have a good handle on how that all fits in- it's just really messy stuff- all code which was provided with the control, but really really hard to figure out.

    I will try testing for a blank row- but It does seem that there's something in the StoreUserData which is vital to the processing later on.

    Thanks for the input.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Posting Permissions

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