Results 1 to 5 of 5

Thread: Database and label problem

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Posts
    71

    Database and label problem

    Previously, I asked if it was possible to make a Flexgrid control transparent. Since nobody answered (*sniff*), I decided to try something else.

    I've created 8 Label controls below eachother (to form a grid), and I've attached this code when the Form loads:

    Code:
    Sub BuildList(ListIndex)
        Dim n
        For n = 0 To 7
            DMain.Recordset.MoveFirst
            DMain.Recordset.Move ListIndex + n
            LblMenu(n).Caption = DMain.Recordset.Fields("LongTitle")
        Next n
    End Sub
    The ListIndex var is a public long and I call the sub from the Form_Load event with "BuildList (0)". So far so good.

    Then I made two scroll buttons, one Up and one Down. I've attached this code, when I click on the Down button:

    Code:
        BuildList (ListIndex + 1)
    The first time I click the button, it works fine, every label is updated correctly (like they scroll upwards). But when i click again, nothing happens. So what's wrong here?

    Secondly, how can I check if the last label (with index 7) is going to reach the EOF of the database and the first label (with index 0) the BOF of the database?

    I hope you understand all of this!

    Dave.

  2. #2
    AIS_DK
    Guest
    1)
    I quess the reason nobody answered you question about making a transparen listview, is properly because it would require a total recording of the listview. You would have to all the drawing yourself.

    2)
    Based on the code you have posted, I think the problem lies in, that you don't save the new value of listindex. So you code should properly be something like this.
    Code:
    Private Sub BuildList(byval NewListIndex as long)
    Dim n as byte
    
    For n = 0 To 7
      DMain.Recordset.MoveFirst
      DMain.Recordset.Move NewListIndex + n
      LblMenu(n).Caption = DMain.Recordset.Fields("LongTitle")
    Next n
    
    Listindex = newListindex
    End Sub
    And please don't declare variables just like "Dim n" it's not good programming. BAD; BAD BOY (just kidding) .
    Declare variables like "Dim n as long" or whatever the type of varible you wan't.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Posts
    71
    OK, I've tried your code, but it doesn't work either, unfortunately. I hope you don't think I use a listbox or something, because the ListIndex is just a variable I declared in a module.

    Secondly, I don't understand why forms and textboxes can be transparent and a Flexgrid control can't. What's the difference (maybe I'm being ignorant, I don't know)?

    Dave.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Posts
    71
    OK, I've got it. Just like you said, the problem was that the ListIndex var wasn't updated. So I changed the code to this:

    Code:
        ListIndex = ListIndex + 1
        BuildList (ListIndex)
    Thanks for your help! Oh, and by the way, my problem is, I learnt VB by trying and experimenting, so I never learnt how to code properly. But from now on, I'll try to declare things properly .

    Dave.

  5. #5
    AIS_DK
    Guest
    Labels and textboxes have been prepared from the creators side to display itself as transparent, the listview hasn't, it's that simple.

    And BTW.
    I learnt VB by trying and experimenting
    Thats the way I learnt it too.

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