Extending Binding Navigator

I've got a VB application that had a custom navigation control that I would like to replace with the System.Windows.Forms.BindingNavigator.  As part of the application look and feel a series of buttons (Disable, Normal, Rollover, MouseDown) have been created.  I want to create a new shared control that inherits from the System.Windows.Forms.BindingNavigator and then sets the images according to mouse states etc.  All pretty standard windows form design behaviour.  I've been struggling to get this to work in VB, so would ask if someone could point me in the correct direction.

Failed example:

Partial Class MyBindingNav

Inherits System.Windows.Forms.BindingNavigator

<System.Diagnostics.DebuggerNonUserCode()> _

Public Sub New(ByVal Container As System.ComponentModel.IContainer)

MyClass.New()

'Required for Windows.Forms Class Composition Designer support

Container.Add(Me)

'Me.MoveNextItem.Image = My.Resources.NavNext_N

End Sub

<System.Diagnostics.DebuggerNonUserCode()> _

Public Sub New()

MyBase.New()

'This call is required by the Component Designer.

InitializeComponent()

 

' The following fails, but represents the basic "initialization" I'd like the component/control to display at design time/runtime.

'Me.AddNewItem.Visible = False

'Me.DeleteItem.Visible = False

'Me.MoveNextItem = New Windows.Forms.ToolStripButton(My.Resources.NavNext_N)

'With Me.BindingNavigatorMoveFirstItem

' .Image = My.Resources.NavFirst_N

' .ImageScaling = ToolStripItemImageScaling.None

'End With

'With Me.BindingNavigatorMoveLastItem

' .Image = My.Resources.NavLast_H

' .ImageScaling = ToolStripItemImageScaling.None

'End With

'With Me.BindingNavigatorMoveNextItem

' .Image = My.Resources.NavNext_N

' .ImageScaling = ToolStripItemImageScaling.None

'End With

'With Me.BindingNavigatorMovePreviousItem

' .Image = My.Resources.NavPrevious_N

' .ImageScaling = ToolStripItemImageScaling.None

'End With

End Sub

'Component overrides dispose to clean up the component list.

<System.Diagnostics.DebuggerNonUserCode()> _

Protected Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing AndAlso components IsNot Nothing Then

components.Dispose()

End If

MyBase.Dispose(disposing)

End Sub

'Required by the Component Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Component Designer

'It can be modified using the Component Designer.

'Do not modify it using the code editor.

<System.Diagnostics.DebuggerStepThrough()> _

Private Sub InitializeComponent()

CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()

Me.SuspendLayout()

CType(Me, System.ComponentModel.ISupportInitialize).EndInit()

Me.ResumeLayout(False)

End Sub

End Class

This code falls over when I try to set the implicit *.Image buttons that come from the BindingNavigation control/Component. I can't seem to find a good example or way to set different defaults.  I've also tried to add the System.Windows.Forms.BindingNavigator to the toolbox/design window, but this also seems to fail.




Answer this question

Extending Binding Navigator

  • Extending Binding Navigator