大家好怎么用C#编写这个VB源码
Dim codes As New System.Windows.Forms.Binding("text", Me.bindingSource1, "ATMCode", True)
Run Code Online (Sandbox Code Playgroud)
我试过写
int codes = new Binding("text", this.bindingSource1, "ATMCode", True);
Run Code Online (Sandbox Code Playgroud)
但VS表示错误无法将类型'System.Windows.Forms.Binding'隐式转换为'int'
var codes = new Binding("text", this.bindingSource1, "ATMCode", true);
Run Code Online (Sandbox Code Playgroud)
上面代码的问题在于它是一个Binding而不是Int.
就像罗伯特说你也可以把它写成......
Binding codes = new Binding("text", this.bindingSource1, "ATMCode", true);
Run Code Online (Sandbox Code Playgroud)
如果你来自VB,这可能不那么令人困惑.