Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Remove Rows from DataGridView C#

$
0
0
I'm working on an application that uses an DataGridView and gets its information from an object,
(see code)
Code Snippet

       private void btnOntvang_Click(object sender, EventArgs e)
        {
           //ReceivedFiles_InitColumns(ref dgv);
        
            DirectoryInfo di = new DirectoryInfo(@"C:\Test");
            dgv.DataSource = di.GetFiles();
           
        }


It fills my DataGridView with everything i need tough what i need in my application is the function to remove an row when nessecary. But i keep getting the same problemen and that is that i dont have an IBindingList
I tryed to use this code:
Code Snippet

        private void btnDel_Click(object sender, EventArgs e)
        {
            dgv.Rows.RemoveAt(dgv.SelectedRows[0].Index);
        }

Tough it gives me the error that i dont have an IBindingList,
is there an way to get an Remove Row function with out having to use the IBindingList,

Any help or suggestions are greatly appiciated
Thanks in Advance
Ben

Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>