Click here to Skip to main content
12,502,578 members (54,746 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
how to set datagridview vertical scrollbar on leftside ??
Posted 15-Nov-12 19:24pm
dcba1894
Comments
smp 234 20-Nov-12 2:13am
   
plz help me
Rate this: bad
 
good
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 .
  Permalink  
Comments
smp 234 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?
Rate this: bad
 
good
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">
<columns>
<asp:BoundField ItemStyle-Width="25%" DataField="test" HeaderText=" Test" />
</columns>
</asp:GridView>
</div>




Add try this code to your gridview in design page.
  Permalink  
Comments
smp 234 23-Nov-12 4:53am
   
Its for asp.net application.
I want it for windows application.
I want vertical scrollbar on left side..
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

http://riteshkk2000.blogspot.in/2009/09/horizontal-scroll-bar-not-appears-in.html[^]



DataGridView1.AutoSizeColumnsMode = NONE (Default) And
 
DataGridView1.ScrollBars = ScrollBars.Both (Default)
  Permalink  
Rate this: bad
 
good
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);
}
  Permalink  

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 | Mobile
Web02 | 2.8.160919.1 | Last Updated 15 Jan 2015
Copyright © CodeProject, 1999-2016
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