事件声明
/// Private WithEvents theMasterGrid As System.Windows.Forms.DataGrid
   /// Private WithEvents theDetailGrid As System.Windows.Forms.DataGrid
这个theMasterGrid()什么意思
///   nEmployeeID = theMasterGrid(theMasterGrid.CurrentRowIndex, 0)

解决方案 »

  1.   

    那个是VB特有的静态事件,没有直接对应的C#语句
    你可以这样:
    Dim WithEvents xxx As XXX
    ...
    xxx = New XXX()
    ...
    Sub xxx_AAA(sender As Object, e As EventArgs) Handles xxx.AAA改为:
    XXX xxx;
    ...
    xxx = new XXX();
    xxx.AAA += this.xxx_AAA;
    ...
    void xxx_AAA(Object sender, EventArgs e)三处分别怎样移植,我已经都告诉你了
    我很奇怪的是,你为什么不直接用VB,如果你有代码的话
      

  2.   

    CType是强制类型转换
    CType(obj, Type)
    就等于
    (Type) obj;AddHandler theMasterGrid.MouseUp, AddressOf Grid_MouseUp
    就等于
    theMasterGrid.MouseUp += new MouseUpEventHandler(this.Grid_MouseUp);VB还支持Base事件的访问,对于C#只能继承下来再用如
    Handles MyBase.Load
    就改成
    this.Load += ....至于这一句
    nEmployeeID = theMasterGrid(theMasterGrid.CurrentRowIndex, 0)
    是VB的默认属性(Default Property),C#只要将省略的属性还原即可
      

  3.   

    Ninputer 好耐心,佩服。
    一个Master/Detail 表现不用翻译了吧,看懂了用C#就写得出了。再说用IDE,真正的代码没几行。