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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listboxex update problem

Status
Not open for further replies.

jaredthensomenumbers

Technical User
Sep 20, 2003
11
GB
Hi

I'm creating an application in Visua Basic.NET

I created a listboxex, and I have a module that raises an event to update the listbox items.

When I use 'listboxex.items.clear' method in the event handler, the program crashes.

Thanking you in advance

Prompt replies would be very appreciated

Regards
Javad Moghisi
 
Any error messages?

Can you show us the event handler code?

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Simple:
Code:
Module Module1
  Sub ClearItems()
    Form1[b].DefInstance[/b].List1.Items.Clear()
  End Sub
End Module


Works to you ?
 
My guess is it doensn't know abouth the instance of Form1 or DefInstance. As jebenson asked before what errors are you getting?

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 

Add the following region in the form1.
Replace the "Form1" with your form's name.


Code:
#Region "Def "
	Private Shared FormDefInstance As Form1
	Private Shared mInitializingDefInstance As Boolean
	Public Shared Property [b]DefInstance() As Form1[/b]
		Get
			If FormDefInstance Is Nothing OrElse FormDefInstance.IsDisposed Then
				InitializingDefInstance = True
				FormDefInstance = New Form1()
				InitializingDefInstance = False
			End If
			DefInstance = FormDefInstance
		End Get
		Set
			FormDefInstance = Value
		End Set
	End Property
#End Region
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top