Ivan Climov

Ivan Climov

  • 1.1k
  • 692
  • 22.4k

How to make the user disappear in “gridControl1” when the us

Dec 5 2018 11:17 PM

Scenario:

- User. Changes in gridControl1 in any line the valueon to the value off;
- Code. Hides the line in gridControl1 and displays the line ingridControl2;
 
I tried this using DataView, but it does not work.
 
How to make the script work?
 
  1. public class ConectDB  
  2. {  
  3.         public DataTable dt;  
  4.           
  5.         static OleDbDataAdapter adapter;  
  6.         static OleDbCommandBuilder cmdBuilder;  
  7.   
  8.         static GridControl gridControlThis;  
  9.   
  10.         public DataView dv1;  
  11.         public DataView dv2;  
  12.   
  13.         public ConectDB()  
  14.         {  
  15.              
  16.         }  
  17.   
  18.         public void connect()  
  19.         {  
  20.             string catBD = @"z:\vs\csharp\prb\718\01_pr\01_pr\01_pr\718.01.01.accdb";  
  21.             string conBD = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", catBD);  
  22.   
  23.             OleDbConnection connection = new OleDbConnection(conBD);  
  24.   
  25.             connection.Open();  
  26.        
  27.             string query1 = "SELECT * FROM TableGrid_00";  
  28.             OleDbCommand cmd1 = new OleDbCommand(query1, connection);  
  29.   
  30.             dt = new DataTable();  
  31.             
  32.   
  33.             try  
  34.             {  
  35.                 adapter = new OleDbDataAdapter(cmd1);  
  36.                 cmdBuilder = new OleDbCommandBuilder(adapter);  
  37.                 adapter.UpdateCommand = cmdBuilder.GetUpdateCommand();  
  38.                 adapter.InsertCommand = cmdBuilder.GetInsertCommand();  
  39.   
  40.             }  
  41.             catch (Exception ex)  
  42.             {  
  43.                 string s = ex.Message;  
  44.                 throw;  
  45.             }  
  46.   
  47.             adapter.Fill(dt);  
  48.   
  49.             dv1 = new DataView(dt);  
  50.             dv1.RowFilter = "groupWork = '???'";  
  51.   
  52.             dv2 = new DataView(dt);  
  53.             dv2.RowFilter = "groupWork = '????'";  
  54.         }  
  55. }  
  56.   
  57. public partial class Frm13UC : UserControl  
  58. {  
  59.   
  60.         ConectDB conectDB;  
  61.   
  62.   
  63.   
  64.         public Frm13UC()  
  65.         {  
  66.             InitializeComponent();  
  67.         }  
  68.   
  69.         private void Frm12_Load(object sender, EventArgs e)  
  70.         {  
  71.             // ???????????  
  72.             conectDB = new ConectDB();  
  73.               
  74.         }  
  75.   
  76.   
  77.         public void FillGrid_1()  
  78.         {  
  79.             conectDB.connect();  
  80.   
  81.             gridControl1.DataSource = conectDB.dv1;  
  82.   
  83.             gridView1.BestFitColumns();  
  84.         }  
  85.   
  86.   
  87.         public void FillGrid_2()  
  88.         {  
  89.             conectDB.connect();  
  90.   
  91.             gridControl2.DataSource = conectDB.dv2;              
  92.   
  93.             gridView2.BestFitColumns();  
  94.         }  
  95. }  

Answers (1)