Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why Isn't This Working???
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00682566
Message ID:
00682818
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Why aren't you simply take the left value of the previous cell + the width of the previous cell?

You are looping and adding (in iRetVal) all the Left properties of each cells!



>I'v created a usercontrol called Cell. I'v also created a usercontrol called Row.
>A Row can contain one or more Cells, aligned across the row one right after each
>other. A Grid would therefore contain one or more Row controls.
>
>I'm having a problem positioning the cells. This code should work, but
>the last cell is off by the width of itself.
>
>Hope that was clear. Heres the code:
>
>Private Function GetNextCellLeftPosition() As Integer
>
>  Dim iCell As Integer
>  Dim iRetVal As Integer
>
>  iRetVal = 0
>
>  For iCell = 0 To RowCells.Count - 1
>
>    If iCell = 0 Then
>      iRetVal = 0
>    Else
>      iRetVal = iRetVal + RowCells(iCell - 1).Left + RowCells(iCell - 1).Width
>    End If
>
>  Next
>
>  GetNextCellLeftPosition = iRetVal
>
>End Function
>
>
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform