Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best practice on binding controls
Message
 
À
23/03/2005 10:19:40
Information générale
Forum:
ASP.NET
Catégorie:
.NET Compact Framework
Divers
Thread ID:
00998417
Message ID:
00998434
Vues:
41
On the "original" form I have also combo, ecc., but today I have created a form with only two textboxes (I'm being crazy on this since yesterday!).
And I create the dataset, fill it, ecc. by code without connecting to SQLCE to try to isolate the problem.
I post some code (cut&paste):
' button1.click
Me.makeds()
Me.TextBox1.DataBindings.Add(New Binding("text", ds.Tables("Customers"), "custid"))
Me.TextBox2.DataBindings.Add(New Binding("text", ds.Tables("Customers"), "custname"))
bmb = Me.BindingContext(ds.Tables("Customers"))    ' declared as Private bmb As BindingManagerBase
' end button1.click

' Me.makeds()
Public Sub makeds()
 ds = New DataSet("myDataSet")
 Dim tCust As DataTable = New DataTable("Customers")

 ' Create two columns, and add them to the first table.
 Dim cCustID As DataColumn = New DataColumn("CustID", _
 System.Type.GetType("System.Int32"))
 Dim cCustName As DataColumn = New DataColumn("CustName")
 tCust.Columns.Add(cCustID)
 tCust.Columns.Add(cCustName)

 ' Add the tables to the DataSet.
 ds.Tables.Add(tCust)
 Dim newRow1 As DataRow
 Dim i As Integer
 For i = 1 To 3
    newRow1 = tCust.NewRow
    newRow1("custID") = i
    ' Adds the row to the Customers table.
    tCust.Rows.Add(newRow1)
 Next

 ' Give each customer a distinct name.
 tCust.Rows(0)("custName") = "Alpha"
 tCust.Rows(1)("custName") = "Beta"
 tCust.Rows(2)("custName") = "Omega"

 ds.AcceptChanges()
End Sub
' end Me.makeds()

' scroll +1
 bmb.Position += 1
' end scroll +1
After I scroll +1 (or -1), that row become "modified" and dataset.haschanges=true
sigh...

Franco

>Franco,
>
>Do you have any other bound controls besides TextBoxes? CheckBoxes maybe? ComboBoxes? Unless the compact framework is way different, TextBox binding should not be causing this to happen.
>
>~~Bonnie
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform