Thank u Bonnie :)
>Ahmad,
>
>Don't add the row with the BindingContext AddNew() method, just add it with the Table NewRow() method.
>
>~~Bonnie
>
>>Cathi can you give me your opnion in this please.
>>
>>I am using DataBinding to bind my DS to my WindowsForms Objects, in fact I hate the databinding but I see it usefull in one thing which is less code!! & not more than that, any how....
>>
>>When I add a new row to my DS, I have no problem (if I don't have to update any field manualy) if I do, I have to add 2 rows and at the end of the stage I remove one of them, I don't see it as practical. the resone for that, I am using the next code to add new row and reset the form field at the same time:
>>
>
>>Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
>> With BindingContext(myDS, "Company")
>> .AddNew()
>> .Position = .Count - 1
>> cbSelect.SelectedIndex = .Count - 1
>> End With
>>End Sub
>
>>
>>the advantage of this code is because of databinding the text field in the form will be empty because it will be binded to a new row.
>>
>>But if I want to add values to some fields manualy at the same time, it will not allow me.
>>So, I have to add the following code with the above code, when Save button click:
>>
>
>>With myDS.Tables("Company")
>> Dim tmpDR As DataRow = .NewRow
>> tmpDR("CompanyID") = strCompanyID
>> tmpDR("Entered") = Now
>> tmpDR("companyname_e") = Me.txtCompanyName_e.Text
>> tmpDR("Email") = Me.txtEmail.Text
>> tmpDR("PostalAddress_e") = Me.rtbPostal.Text
>> tmpDR("Location_e") = Me.rtbLocation.Text
>> .Rows.Add(tmpDR)
>>End With
>
>>
>>This way 2 rows added to the DS, so I delete the first added row:
>>' The added Row in the "Add" Sub will be removed
>>With BindingContext(myDS, "Company")
>> .RemoveAt(iRow)
>>End With
>>
>>Do you have any idea to allow me to use databinding & manual if adding method?
>>
>>BR
<><><><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><><><>