Click here to Skip to main content
13,250,043 members (69,198 online)
Rate this:
Please Sign up or sign in to vote.
See more:
how to set datagridview vertical scrollbar on leftside ??
Posted 15-Nov-12 20:24pm
smp 234 20-Nov-12 2:13am
plz help me
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Place the gridview in div and set the height for the div
and set overflow-y:scroll option to that .
smp 234 23-Nov-12 3:25am
I want it in 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
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

<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">
<asp:BoundField ItemStyle-Width="25%" DataField="test" HeaderText=" Test" />

Add try this code to your gridview in design page.
smp 234 23-Nov-12 4:53am
Its for 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...
Rate this: bad
Please Sign up or sign in to vote.

Solution 3[^]

DataGridView1.AutoSizeColumnsMode = NONE (Default) And
DataGridView1.ScrollBars = ScrollBars.Both (Default)
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

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.

[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);

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 15 Jan 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100