Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable splits in datagrid 1

Status
Not open for further replies.

Glasgow

IS-IT--Management
Jul 30, 2001
1,669
GB
I give up! How do I prevent the user from creating splits in a datagrid control? I can find no property, method or event to trap that would appear to help me with this.

Surely there must be a way? I hope I'm missing something obvious.
 
The datagrid can be split into vertical sections that scroll as separate units - check out the Split property.
 
Since I was dumb enough not to know about it, and I don't have the time to figure it out, I'd say just put a picture in that stupid little corner to mask the split control. But the help file does say it can be disallowed. Sorry.
 
Actually that's exactly what I did as a workaround but it's a hassle cos I now have to work out whether the horizontal scrollbar is visible (dunno how at the moment) - as then the 'picture in that stupid little corner' does not appear when there is no scrollbar.

 
In the split tab of the datagrid control, I just changed the sizing option (i think), the one at the bottom right) to exact. This way, they can still create new splits, but they don't show up. All you'd have to do is keep track of how many splits you got, and remove them as soon as one is created (I'd suggested a good old timer, but there might be an event of some sort).
 
That's a better solution, thanks. I already have a timer running on the grid so I can just zap the code in there.

As this affects virtually every form in my application, I have coded at runtime as:
Code:
DataGrid1.Splits(0).SizeMode = dbgExact
and in the timer
Code:
For i = Fm.Frm.dgdSelect.Splits.Count - 1 To 1 Step -1
  DataGrid1.Splits.Remove i
Next i
Have a star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top