Hello Muran Kelleci,
Take this as a example
Create a form in VB.NET solution and name it as Form1, put a ListBox on form
and name it ListBox1 and put one button on form and name it Button1
now, add one module in VB.NET solution and name it Module1
in that module create a new public function called AddList and pass
parameters for form, and then under that function declarea new List box as a
myList and assign it with the myForm's control and then use myList listbox
as you use the normal list box.
Here the example:
Public Function AddList(ByVal myForm As Form)
Dim myList As New ListBox
myList = myForm.Controls.Item(1)
myList.Items.Add("Test")
End Function
Now, in Form1, double click on the Button which you created and write the
following code in Button1_Click event which will call the AddList function
and will pass the current form as a parameter.
example:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
AddList(Me)
End Sub
and then run your solution by pressing F5 Key, and then click on Button1
which you placed on the Form1 and check it, it will work.
Hope this helps, feel free to ask more.
Dhaval Faria.
Microsoft India Community Star
Founder, Programmer.
Hirdhav (
http://www.hirdhav.com)