Groups | Blog | Home
all groups > dotnet windows forms designtime > november 2004 >

dotnet windows forms designtime : Designer/properties databinding, how???


Julie
11/11/2004 1:10:35 PM
I'm trying to use data bindings through the control designer properties, and
getting
nowhere at light-speed. The online help for data bindings is virtually useless
as a tutorial on the subject, and I haven't been able to locate anything
through Google.

I've set up data bindings manually, and they work just fine, but I'm just
trying to figure out how to do it through the property page for the control.
Manually (simplified), this is what I have (C# windows form app):

public class Parameters
{
private string userName;
public string UserName
{
get { return userName; }
set { userName = value; }
}
// etc.
}

public class MyForm : Form
{
private Parameters parms = new Parameters();
private TextBox txtUserName;

public MyForm()
{
InitializeComponent();
txtUserName.DataBindings.Add(new Binding("Text", parms, "UserName"));
}
// etc.
}

and everything works just dandy.

*However*, what I want to be able to do is to create the databinding
automatically through the property page DataBindings. For the txtUserName
control, the DataBindings Text drop down has (none), and if I type something
like parms.UserName, I get an "Invalid property value" error. I've tried
"parms.UserName", parms, "UserName", etc., and nothing works.

So, finally my question: where is some decent documentation & tutorial on how
to use the DataBindings from the property page? Anyone have any comments on
John Saunders
11/12/2004 11:03:12 AM
[quoted text, click to view]

The following is more information than you're looking for, but you might
want to bookmark it for later:
INFO: Roadmap for Windows Forms Data Binding
(http://support.microsoft.com/kb/313482#4b).

John Saunders


AddThis Social Bookmark Button