Re[3]: WinForms: вопрос по Binding
От: Smarty Россия  
Дата: 31.03.04 21:36
Оценка:
MB>Теперь попытаюсь кратко указать на свои ошибки:
MB>1.
MB>Я писал так:
MB>this.textBox1.DataBindings.Add("Text", Form1.form1.dataSet11, "Orders.CustomerID");

MB>А нужно было писать так:

MB>this.textBox1.DataBindings.Add("Text", Form1.form1.dataSet11.Orders, "CustomerID");
Короче — вот(копирайт не мой, ессесно):
// 1. Bind to data set + table.column (good!) — это как раз вариант 1 выше
textBox1.DataBindings.Add(Text", customerSet1, "Customers.ContactTitleName");

// 2. Bind the table + column (BAD!) — а это как раз вариант 2 выше
textBox1.DataBindings.Add("Text", customerSet1.Customers, "ContactTitleName");

Although both techniques of binding to a column seem to display equivalent results, there is an "issue" in .NET 1.x that causes inconsistencies if you mix the two methods. The reason to always use technique 1 (data set + table.column) is that the Designer-generated code uses this technique when you choose a data member in the Property Browser.

Короче — непрекрытая агитация за вариант 1.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.