开发者

Why can't I access the public System.Windows.Forms.BindingSource of a form?

I开发者_如何转开发 have a form1 with a binding source created by VS as

private System.Windows.Forms.BindingSource bindingSource1

I have changed private to public

Sill Intellisence doesn't recognize

form1.BindingSource

within another form2

Form1 form1 = new Form1();
form1.bindingSource1 = ...;

Why ?


You haven't shown the name of the field - only the type. For instance, it might be:

public System.Windows.Forms.BindingSource bindingSource1;

You also need to make sure your form1 variable is of the right type (rather than just Form). If you could give a short but complete example, that would help.

Personally I would avoid making the fields public though - if you really need to expose the binding source, use a property to access it.


In this particular example, BindingSource is the type of the member. It's not clear from your sample what the name of the member is. So you can in effect be binding to the wrong name

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜