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

Hoe to remove gray space from datagridview in c# windows form

$
0
0

hi, i'm trying to remove blank space from datagridview. the datagridview is bind with sqlite database.

after run the project

i use this code

private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                dataGridView1.MaximumSize = new Size(this.dataGridView1.Width, 0);
                dataGridView1.AutoSize = true;

                using (SQLiteConnection conn = new SQLiteConnection("Data Source=data.db"))
                {
                    string CommandText = "SELECT * FROM testing";
                    using (SQLiteDataAdapter sda = new SQLiteDataAdapter(CommandText, conn))
                    {
                        DataSet ds = new DataSet();
                        sda.Fill(ds);
                        dataGridView1.DataSource = ds.Tables[0].DefaultView;
                    }
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

how can i resolve this....


Viewing all articles
Browse latest Browse all 2535

Trending Articles



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