Data binding syntax?

J

Julie

I'm trying to use data bindings through the control 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;
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
correct usage?
 
D

Daniel O'Connell [C# MVP]

Julie said:
Anyone have any comments on this topic?

This is really off-topic in the groups you posted to.
Have you tried posting your question to
microsoft.public.dotnet.framework.windowsforms.databinding
?
 
J

Julie

Daniel O'Connell said:
This is really off-topic in the groups you posted to.
Have you tried posting your question to
microsoft.public.dotnet.framework.windowsforms.databinding

Noooo -- I was not aware suce a newsgroup existed. I shall take my question
there with great haste.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top