PC Review


Reply
Thread Tools Rate Thread

Datagrid ScrollBar always visible: StackOverflowException

 
 
Guest
Posts: n/a
 
      29th Aug 2003
Hi all.
I build a new class for DataGrid control adding an handler to always show a
Vertical ScrollBar in the grid. The code is below.

----------------------------------------------
Public Class MyDataGrid
Inherits DataGrid

Private _imgList As ImageList
Public Event CurrentRowChanged()
Private oldSelectedRow As Integer = -1

Public Sub New()
AddHandler MyBase.VertScrollBar.VisibleChanged, AddressOf ShowScrollBars
MyBase.VertScrollBar.Visible = True
End Sub 'New

Private Sub ShowScrollBars(ByVal sender As Object, ByVal e As EventArgs)
If Not MyBase.VertScrollBar.Visible Then
Dim width As Integer = MyBase.VertScrollBar.Width
MyBase.VertScrollBar.Location = New
Point(MyBase.ClientRectangle.Width - width - 2, 2)
MyBase.VertScrollBar.Size = New Size(width,
MyBase.ClientRectangle.Height - 4)
MyBase.VertScrollBar.Show() [****]
End If
End Sub

end class
----------------------------------------------------

It runs well: adding new rows to the grid (programmatically) updates/resizes
the VScrollBar automatically showing the VScrollBar since the beginning,
even if there are a few rows in the grid. Adding new rows, simply updates
the VScrollBar (through the Sub above) and all it's OK.

The problem is when I use a TabControl. I put the datagrid on a TabPage and
click for creating new rows staying on the "2nd TabPage": this operation
causes a StackOverflowException while executing the line [****].

Uhmm... I don't know absolutely what's the real problem. Can anyone help me?

Many thanks
Francesco



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help! - DataGridView - scrollbar not visible John Dann Microsoft VB .NET 5 7th Dec 2008 08:50 PM
Datagrid scrollbar is not visible Milan Microsoft Dot NET 0 25th Oct 2006 02:08 PM
Scrollbar not visible Milan Microsoft VB .NET 0 25th Oct 2006 02:03 PM
want to make scrollbar always visible Tim B Microsoft Access 0 20th Jul 2006 02:26 AM
Re: How can i send the DataGrid ScrollBar to first point of DataGrid ? Herfried K. Wagner [MVP] Microsoft Dot NET Framework Forms 0 3rd May 2004 11:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:07 AM.