DataGrid的内容改变了是触发哪一个事件。
比如用户在DataGrid中增加或者修改了一个记录中的属性应该是触发哪一个事件。
100分吐血狂求啊~~~

解决方案 »

  1.   

    Private Sub dg_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dg.CurrentCellChanged    End Sub
      

  2.   

    帮你差了,C#里面的CurrentCellChanged事件在事件的"属性"那一拦里
      

  3.   

    楼上兄弟,应该不是这个吧,这个是datagrid的cell焦点改变就触发,而不是cell中的text改变而触发。
      

  4.   

    呵呵,不好意思哈!仔细看了下,好象没有这个属性哦.我一直用的第三方控件C1flexgrid.
    1.使用第3芳控件2.你也可以自己写个事件3.可以利用数据源的行状态来判断
      

  5.   

    我现在是想做这样一个功能,一个窗体中有一个dataGrid控件,一个保存按钮。
    一开始保存按钮是enable的,只有在dataGrid中的任何一个cell的text有变更的时候才触发保存按钮为可用状态。而CurrentCellChanged事件是在鼠标焦点一进入就触发了。
      

  6.   

    to:meiqingsong(阿飛)
    CellBeginEdit()
    CellEndEdit()
    这两个是方法还是事件,如果是事件的话在哪里找呢?
      

  7.   

    Look sample
    http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q773q
      

  8.   

    to:yz1199(逃离孤独)
    自己写个事件要怎么写呢,我没自己写过事件,能发个源码来吗。
      

  9.   

    哇~这为Knight94(愚翁)大大发的是英文的资料,我看看~
      

  10.   

    public class DataGridColorTextBoxColumn : DataGridTextBoxColumn
    {

    public DataGridColorTextBoxColumn ():base()
    { }
    this.TextBox.TextChanged += new EventHandler(TextBox_TextChanged);
    }
    过两天我将实现DATAGRID单元格变色的代码发布到我的blog上
      

  11.   

    public event System.EventHandler TextChanged
        System.Windows.Forms.DataGrid 的成员
      

  12.   

    CellBeginEdit()
    CellEndEdit()
    是事件,我用的是VS2005不知道VS2003有没有,
      

  13.   

    to:lgyangell() 
    public event System.EventHandler TextChanged
    dataGrid找不到该事件,兄弟用的是2005吗。to:meiqingsong(阿飛) 
    CellBeginEdit()
    CellEndEdit()
    这两个在2003下没找到。
      

  14.   

    to:serversql(啊初) 
    你这个可以,但是我不知道要怎么实现~~
      

  15.   

    2003下面就有,你直接继承dataGrid这个类。TextChanged是这个类的一个成员。继承过来以后就可以用了~你看一下类视图就明白了
      

  16.   

    How can I tell if the current row has changed and whether I am on the AddNew row or not?     private System.Windows.Forms.DataGrid dataGrid1; 
     
    private BindingManagerBase bindingManager; 
      
    private void Form1_Load(object sender, System.EventArgs e) 
     

     
         // Creating connection and command sting 
     
         string conStr = @"Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb"; 
     
         string sqlStr = "SELECT * FROM Employees"; 
     
         // Create connection object 
     
         OleDbConnection conn = new OleDbConnection(conStr); 
     
         // Create data adapter object 
     
         OleDbDataAdapter da = new OleDbDataAdapter(sqlStr,conn); 
      
         // Create a dataset object and fill with data using data adapter's Fill method 
     
         DataSet ds = new DataSet(); 
     
         da.Fill(ds, "Employees"); 
     
         dataGrid1.DataSource = ds.Tables["Employees"]; 
     
         bindingManager = this.BindingContext[dataGrid1.DataSource]; 
     
         bindingManager.PositionChanged += new System.EventHandler(RowChanged); 
     

      
    private void RowChanged(object sender, System.EventArgs e) 
     

     
         Console.WriteLine("RowChanged " + bindingManager.Position.ToString() ); 
     
         bool lastRow = bindingManager.Count > ((DataTable)dataGrid1.DataSource).Rows.Count; 
     
          
     
         if(lastRow) 
     
              Console.WriteLine("lastRow"); 
     
    }
     
    这个就是利用了数据源的方式来添加一个事件的.这是增加行的例子
      

  17.   

    to:lgyangell()
    你说的方法不错,但是实在搞不来。你确定你有用过吗?好象serversql(啊初)的方法才是正确的。