Call function from second form to base form

G

GeertL

Hi,

I think this is a very common problem :

I have a main form with a listview. From this form i call a second form
to add items to this list. (input form)

Private Sub cmdOpmerkingToevoegen_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmdOpmerkingToevoegen.Click
Dim frmProblem As New FrmAddProblem
frmProblem.Show()
End Sub

i have a subroutine on the main form that fills the listview with
items. The problem is when i add a new item i can't automaticly fill
the list in the mainform. How can i achieve this. Can i call the
routine Filllist() from the second form (frmproblem) ??

Any ideas anyone ?

Tnx in advance
Geert
 
B

Bob Powell [MVP]

Just create a property in the second form to accept a value of type Form or
Form1.

Cast this property to Form1 (or use it directly) to access the public
members and methods of the form.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
G

GeertL

Tnx for the reply

Do you have a code sample for this? It would help a lot.

greetz

Bob Powell [MVP] schreef:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top