Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to set datagridview vertical scrollbar on leftside ??
Posted
Comments
dcba1 20-Nov-12 2:13am    
plz help me

Place the gridview in div and set the height for the div
and set overflow-y:scroll option to that .
 
Share this answer
 
Comments
dcba1 23-Nov-12 3:25am    
I want it in vb.net windows application. I am not getting what you want to say.
how to set overflow-y:scroll?
Arunachalam Gurusamy 14-Aug-17 15:46pm    
stupid answer. Questioner asked how to place the scrollbar in left side. First understand the question and reply, otherwise shut both of yourself
XML
<div style="width: 100%; height: 350px; overflow-y: scroll;">
    <asp:GridView ID="gvtesr" runat="server" AutoGenerateColumns="false" CellSpacing="0" Width="100%" CellPadding="4" ClientIDMode="Static" Border="0" BorderColor="White">
<columns>
<asp:BoundField ItemStyle-Width="25%" DataField="test" HeaderText=" Test" />
</columns>
</asp:GridView>
</div>





Add try this code to your gridview in design page.
 
Share this answer
 
Comments
dcba1 23-Nov-12 4:53am    
Its for asp.net application.
I want it for windows application.
I want vertical scrollbar on left side..
Arunachalam Gurusamy 14-Aug-17 15:47pm    
unnecessary explanation. Idiotic reply. First read the question...
I used this code to move my vertical scroll bar from the right of my datagridview to the left hand side.

I called MoveVerticalScrollBar after I bind my datagridview and I pass it the datagridview.

C#
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags);

public static void MoveVerticalScrollBar(DataGridView gvHistory)
{
   const short SWP_NOZORDER = 0X4;
   const int SWP_SHOWWINDOW = 0x0040;

   IntPtr handle = new IntPtr();
   foreach (ScrollBar scroll in gvHistory.Controls)
      if (scroll.GetType() == typeof(VScrollBar))
         handle = scroll.Handle;

   var form = Control.FromHandle(handle);
   SetWindowPos(handle, 0, 0, 0, form.Bounds.Width, form.Bounds.Height, SWP_NOZORDER | SWP_SHOWWINDOW);
}
 
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