Hi,
I am new to VB .net (long time VBA programmer) and was trying to
integrate a freeware list bar control into a windows mdi child form in
VB.net 2005 Express. I think I am doing it right, obviously I'm not
though!...
Details of the control itself and links to the dll's required are on;
=http://www.vbaccelerator.com/home/NE...tBar/VSNet_Sty...
So, in the project I have referenced the two dlls mentioned and have
plonked the VSNetListBar control into an otherwise empty form.
I have added the following sample script (converted to VB from CS
minus the random number bit).
************************************************** ************************************************** *
Imports vbAccelerator.Components.ListBarControl
Imports System.Windows.Forms
Public Class frmChild
Private Sub VsNetListBar1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles VsNetListBar1.Load
' Create 4 bars and add a random number of items to each:
Dim i As Integer = 0
Do While (i < 4)
' Create the items:
Dim jMax As Integer = (5)
Dim subItems(jMax - 1) As VSNetListBarItem
Dim j As Integer = 0
Do While (j < jMax)
subItems(j) = New VSNetListBarItem(String.Format("Test
Item {0} in Bar {1}", (j + 1), (i + 1)), (j Mod 4),
String.Format("Tooltip text for test item {0}", (j + 1)))
If (j = 2) Then
subItems(j).Enabled = False
End If
j = (j + 1)
Loop
' Create the group and add the sub items:
Me.VsNetListBar1.Groups.Add(New
VSNetListBarGroup(String.Format("Test {0}", (i + 1)), subItems))
i = (i + 1)
Loop
End Sub
End Class
************************************************** ************************************************** **
But a get the following exception detail.
************************************************** ************************************************** **
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="acclVSNetListBar"
StackTrace:
at
vbAccelerator.Components.ListBarControl.VSNetListB arItem.DrawButton(Graphics
gfx, ImageList ils, Font defaultFont, ListBarDrawStyle style,
ListBarGroupView view, Int32 scrollOffset, Boolean controlEnabled,
Boolean skipDrawText)
at
vbAccelerator.Components.ListBarControl.ListBarIte mCollection.Draw(Graphics
gfx, Rectangle bounds, ImageList ils, Font defaultFont,
ListBarDrawStyle style, ListBarGroupView view, Boolean enabled, Int32
scrollOffset)
at
vbAccelerator.Components.ListBarControl.VSNetListB arGroup.DrawBar(Graphics
gfx, Rectangle bounds, ImageList ils, Font defaultFont,
ListBarDrawStyle style, Boolean controlEnabled)
at
vbAccelerator.Components.ListBarControl.ListBar.Re nder(PaintEventArgs
pe)
at
vbAccelerator.Components.ListBarControl.ListBar.On Paint(PaintEventArgs
e)
at
System.Windows.Forms.Control.PaintWithErrorHandlin g(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationCo ntext
context)
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[]
commandLine)
at DAC.My.MyApplication.Main(String[] Args) in 17d14f5c-
a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly,
String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object
state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
************************************************** ************************************************** **
Any help greatly received!
Thanks,
Baz