Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My datagridview does not fit all columns in c # winform. I am using Visual studio 2012
Posted
Comments
Ralf Meier 30-Jul-15 3:35am    
... and what do you want to know / to do ?
Eng.Yahya92 30-Jul-15 3:41am    
use your prophecy
Member 10908573 30-Jul-15 22:07pm    
Thanks. My datagridview does not fit all rows within the grid when I maximised the winform. My datagridview is filled with data using the following query;

conn = new OleDbConnection();
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=C:\\OBSAccess\\OBSAccountsDatabase.accdb;";

conn.Open();

adapts = new OleDbDataAdapter("SELECT accountnumber as 'Account No', accountname as 'Account',accounttype as 'Type',transactdescription as 'Trans Description',postingdate as 'Creation Date',documenttype as 'Doc Type',documentnumber as 'Doc No',documentdate as 'Doc Date',transdate as 'Trans Date',reportingcurrency as 'Currency', (debitentry-creditentry) as Balance from GeneralLedger", conn);
dataset = new System.Data.DataSet();
adapts.Fill(dataset);
gl.DataSource = dataset.Tables[0];

conn.Close()

I am aware of the fact that my query is prone to SQL injection. However, what I want to know is how to sort out the problem with the datagridview.

Please,I need your help again..
Member 10908573 30-Jul-15 22:08pm    
The data in my winform reportviewer is not showing data well. I mean it is not well arranged with cells. The gridlines are also not well arranged.

If you want show scrollbar then simply,
1. Select the datagridview
2. Go to properties
3. Set ScrollBars property to either Horizontal

You can set this in code also like-
C#
yourDataGridView.ScrollBars = ScrollBars.Horizontal;


Hope, it helps :)
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900