This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C4CB58.39DB7220
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am using databinding with a few textboxes. I also have a grid on a =
separate screen where I show the entered data plus more details.

I can go into the grid the delete records.

When I later reopen the grid, if I have deleted all of the rows, I will =
add a single new row to the grid. Part of this process for adding the =
new row is that I get the ID, which is a guid, of the row that I have =
added and set that to a property within my class.

In order to set the currency manager, I need to get the ProposedCostID =
of the new row and loop through each row until I get the index of the =
row. (NOTE: you cannot use a Find on a column that is a GUID, I found =
that out the hard way). Once I have the index, I can set the currency =
manager.

I then use this property to set the currency manager so that the data on =
the screen will be bound to the correct record. The real problem below =
is that the index retrieved is not really the index, it just happens to =
be that way because of the way I set the counter. This looping works =
correctly if I do not have deleted records in the table.

-------------------------------------------------------------------------=
-------------------------------------------------------------------------=
---------------------
'Here is my code for getting the currency manager and the property
Dim liRowIndex As Integer
Dim lCurrMgr As CurrencyManager
Dim myRow As DataRow

liRowIndex =3D 0

For Each myRow In ds.Tables(strTable).Rows
If myRow.RowState <> DataRowState.Deleted Then

'the new row was added prior to calling this function. The new guid =
was stored in the class property
'ProposedCostID. Loop through the rows to get the index of the row =
that has a matching guid
Dim strG As Guid
strG =3D myRow.Item("ProposedCostID")
If (strG.ToString =3D Me.ProposedCostsID.ToString) Then
Exit For
End If

liRowIndex =3D liRowIndex + 1

End If

Next



lCurrMgr =3D CType(Me.BindingContext(ds.Tables(strTable)), =
CurrencyManager)

' Set the initial Position of the control.
lCurrMgr.Position =3D liRowIndex



------------------------------------------------

I'm not sure, maybe my only choice around this mess is to truly save the =
data to the database each time a row is deleted, then everything should =
be set correctly.

Any help appreciated.



Norton

------=_NextPart_000_0008_01C4CB58.39DB7220
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2523" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I am using databinding with a few =
textboxes. I also=20
have a grid on a separate screen where I show the entered data plus more =

details.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I can go into the grid the delete=20
records.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>When I later reopen the grid, if I have =
deleted all=20
of the rows, I will add a single new row to the grid. Part of this =
process for=20
adding the new row is that I get the ID, which is a guid, of the row =
that I have=20
added and set that to a property within my class.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>In order to set the currency manager, I =
need to get=20
the ProposedCostID of the new row and loop through each row until I get =
the=20
index of the row. (NOTE: you cannot use a Find on a column that is a =
GUID, I=20
found that out the hard way). Once I have the index, I can set the =
currency=20
manager.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I then use this property to set the =
currency=20
manager so that the data on the screen will be bound to the correct =
record. The=20
real problem below is that the index retrieved is not really the index, =
it just=20
happens to be that&nbsp;way because of the way I set the counter. This =
looping=20
works correctly if I do not have deleted records in the =
table.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2>----------------------------------------------------------------=
-------------------------------------------------------------------------=
------------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>'Here is my code for getting the =
currency manager=20
and the property</FONT></DIV>
<DIV>
<P><FONT face=3DArial size=3D2>Dim liRowIndex As Integer<BR></FONT><FONT =
face=3DArial=20
size=3D2>Dim lCurrMgr As CurrencyManager<BR></FONT><FONT face=3DArial =
size=3D2>Dim=20
myRow As DataRow</FONT></P>
<P><FONT face=3DArial size=3D2>liRowIndex =3D 0</FONT></P>
<P><FONT face=3DArial size=3D2>For Each myRow In=20
ds.Tables(strTable).Rows<BR></FONT><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;=20
</FONT><FONT face=3DArial size=3D2>If myRow.RowState &lt;&gt; =
DataRowState.Deleted=20
Then</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;'the new row was =
added prior=20
to calling this function. The new guid was stored in the class=20
property<BR>&nbsp;&nbsp;&nbsp; 'ProposedCostID.&nbsp; Loop through the =
rows to=20
get the index of the row that has a matching guid</FONT><FONT =
face=3DArial=20
size=3D2><FONT face=3DArial =
size=3D2><BR></FONT>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT=20
face=3DArial size=3D2>Dim strG As Guid<BR></FONT><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp; strG =3D =
myRow.Item("ProposedCostID")<BR></FONT><FONT=20
face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; If (strG.ToString =3D=20
Me.ProposedCostsID.ToString) Then<BR></FONT><FONT face=3DArial=20
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exit =
For<BR></FONT><FONT=20
face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; End If</FONT></P>
<P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; liRowIndex =3D =
liRowIndex +=20
1</FONT></P>
<P><FONT face=3DArial size=3D2>End If</FONT></P>
<P><FONT face=3DArial size=3D2>Next</FONT></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2>lCurrMgr =3D=20
CType(Me.BindingContext(ds.Tables(strTable)), =
CurrencyManager)</FONT></P>
<P><FONT face=3DArial size=3D2>' Set the initial Position of the=20
control.<BR></FONT><FONT face=3DArial size=3D2>lCurrMgr.Position =3D=20
liRowIndex<BR></FONT><FONT face=3DArial size=3D2><BR></FONT></P>
<P><FONT face=3DArial=20
size=3D2>------------------------------------------------</FONT></P>
<P><FONT face=3DArial size=3D2>I'm not sure, maybe my only choice around =
this mess=20
is to truly save the data to the database each time a row is deleted, =
then=20
everything should be set correctly.</FONT></P>
<P><FONT face=3DArial size=3D2>Any help appreciated.</FONT></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2>Norton</FONT></P></DIV></BODY></HTML>

------=_NextPart_000_0008_01C4CB58.39DB7220--