I have one form that is having Scrollbar, i want to disable the scroll button that is present in vertical scroll bar with single click up and down movement buttons working...
can any one help me in this?
Try this ...
VScrollBar vsb = DataGridView1.Controls.OfType(Of(VScrollBar)).SingleOrDefault;
vsb.LargeChange = vsb.SmallChange;
You will find the answer here: Hide vertical scroll bar in ListBox control
Basically, you cannot hide it. You can only make it always show or auto show if it is needed. Otherwise, you may need to make a custom control to do what you want.
The link also shows you how to create a class library to do this (taken directly from the link):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ClassLibrary1
{
public class MyListBox : System.Windows.Forms.ListBox
{
private bool mShowScroll;
protected override System.Windows.Forms.CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
if (!mShowScroll)
cp.Style = cp.Style & ~0x200000;
return cp;
}
}
public bool ShowScrollbar
{
get { return mShowScroll; }
set
{
if (value == mShowScroll)
return;
mShowScroll = value;
if (Handle != IntPtr.Zero)
RecreateHandle();
}
}
}
}