Add toolbar on datagridview in VB.Net -
i created custom control inherits datagridview , add custom properties. add toolbar control docked on top of can have functionalities add row, delete row etc. displays image below:

as can see columnheader under toolbox control...i want them not overlap each other...please help.
edit
i insert custom property one:
dim _toolbox_ toolstrip dim _showtoolbar boolean public property showtoolbar() boolean return _showtoolbar end set(byval value boolean) _showtoolbar = value if value = true _toolbox_ = new toolstrip mybase.controls.add(_toolbox_) _toolbox_.dock = windows.forms.dockstyle.top _toolbox_.visible = true else mybase.controls.remove(_toolbox_) _toolbox_ = nothing end if end set end property
the problem here toolstrip control inside datagridview, , such location origin (0,0) top left corner of datagridview.
in instance might better off creating user control allows place toolstrip above datagridview. expose both of them properties can still access controls' own properties , methods, , add property turn display of toolstrip on or off, , set position of datagridview appropriately:
dim _showtoolbar boolean dim _toolbox toolstrip public property showtoolbar() boolean return _showtoolbar end set(byval value boolean) _showtoolbar = value if value if _toolbox nothing _toolbox = new toolstrip() me.controls.add(_toolbox) end if _toolbox.location = new system.drawing.point(0,0) _datagridview.location = new system.drawing.point(0,_toolbox.size.height) _toolbox.visible = true else _toolbox.visible = false _datagridview.location = new system.drawing.point(0,0) end if end set end property all of brain compiler, there might errors in there, should started.
Comments
Post a Comment