Dear Heath, Thanks for the tips. I will keep in mind for future postings. I tried sending EM_SHOWSCROLLBAR message by P/Invoking SendMessage, But It did not work in my case. However, I could solve the problem by P/Invoking GetSystemMetrics, CreateRectRgn, SetWindowRgn. I am pasting the code for future reference.
private const int SM_CXVSCROLL = 2;
//
[System.Runtime.InteropServices.DllImport("user32")]
public static extern int GetSystemMetrics(int nIndex);
//
[System.Runtime.InteropServices.DllImport("gdi32")]
public static extern int CreateRectRgn(int X1, int Y1, int X2, int Y2) ;
//
[System.Runtime.InteropServices.DllImport("user32")]
public static extern int SetWindowRgn(int hwnd, int hRgn, bool bRedraw);
public void HideVerticalScrollBar(RichTextBox rtb)
{
//get scroll bar width
int scrollbarWidth = WinApi.GetSystemMetrics(SM_CXVSCROLL);
// handle of the region
int handleRgn = WinApi.CreateRectRgn(0, 0, rtb.Width , rtb.Height);
//change the width of the rtb
rtb.Width += scrollbarWidth;
//set window region
WinApi.SetWindowRgn(rtb.Handle.ToInt32(), handleRgn, true);
}
Regards, Jay.