如果不和数据库连接的话,那么用xml,然后用DataSet绑定!要保存的时候用
StreamWriter myStreamWriter = new StreamWriter(xmlFilename);
DataSet1.WriteXml(myStreamWriter);

解决方案 »

  1.   

    xml如何使用?能给讲解一下吗?
      

  2.   

    combobox添加代码:
     // Step 1. Derive a custom column style from DataGridTextBoxColumn 
     
         //     a) add a ComboBox member 
     
         // b) track when the combobox has focus in Enter and Leave events 
     
         // c) override Edit to allow the ComboBox to replace the TextBox 
     
         // d) override Commit to save the changed data 
       
         // Step 2 - Use the combo column style 
     
         // Add 1 col with combo style 
     
         DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn(); 
     
         ComboTextCol.MappingName = "custCity"; 
     
         ComboTextCol.HeaderText = "Customer Address"; 
     
         ComboTextCol.Width = 100; 
     
         ts1.GridColumnStyles.Add(ComboTextCol); 
      
         // Step 3 - Additional setup for Combo style 
     
         // a) make the row height a little larger to handle minimum combo height 
     
         ts1.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 3; 
     
         // b) Populate the combobox somehow. It is a normal combobox, so whatever... 
     
         ComboTextCol.ColumnComboBox.Items.Clear(); 
     
         ComboTextCol.ColumnComboBox.Items.Add("Chicago"); 
     
         ComboTextCol.ColumnComboBox.Items.Add("Corvallis"); 
     
         ComboTextCol.ColumnComboBox.Items.Add("Denver"); 
     
         ComboTextCol.ColumnComboBox.Items.Add("Great Falls"); 
     
         ComboTextCol.ColumnComboBox.Items.Add("Kansas City"); 
     
         ComboTextCol.ColumnComboBox.Items.Add("Los Angeles"); 
     
         ComboTextCol.ColumnComboBox.Items.Add("Raleigh"); 
     
         ComboTextCol.ColumnComboBox.Items.Add("Washington"); 
      
         // c) set the dropdown style of the combo... 
     
         ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList;