Click here to Skip to main content
16,007,443 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys, Im just a newbie in vb.net. Just want to ask for help.. Here's my problem. i have a parent form which i call frmKitchen. Inside it, i have a listview and an user control. I want to reload all the items in the listview when something change in my user control. someone told me to Create an event in my UserControl to signal that any subscriber. but i dont know how.. im just a newbie. please help me.

What I have tried:

main form:

VB.NET
Public Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
       selectDistOfItem()
       getAndDisplaySum()
       Me.Refresh()
   End Sub


User Control:
VB.NET
Private Sub lvOrders_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lvOrders.DoubleClick
        If lvOrders.SelectedItems.Count > 0 Then
         'some codes here
        Dim kit As New frmKitchen
        kit.btnRefresh_Click(Nothing, Nothing)

        End If
    End Sub
Posted
Updated 19-Dec-16 15:51pm

1 solution

So, you asked this question 21 hours ago, here[^], got the answer 8.5 hours ago, then decided to ignore that answer and post your question again?

Not cool.

The answer isn't going to change, no matter how many times you ask the question.
 
Share this answer
 
v2
Comments
l3ugs.l3unny 19-Dec-16 21:53pm    
sorry dave, i cant understand the link that you gave to me. its very complicated to me cause im just a newbie. can you please tell me where to put the codes.? sorry.
Dave Kreskowiak 19-Dec-16 22:11pm    
And you think an even shorter description in a forum is going to make more sense?

The walkthroughs are in those search results for a reason. Just looking at one or two links probably isn't going to do it for you. You have to go through a LOT of those links. It's called research and it's a major part of doing this job.

Just about all of the code goes in the UserControl. It has to define the event, the arguments passed in the event (if any) and manage the list of subscribers.
l3ugs.l3unny 19-Dec-16 23:04pm    
i followed everything in the tutorials. but i guess im not doing it right. sorry dave. thanks anyway.
Dave Kreskowiak 20-Dec-16 10:06am    
Every one of those links or just one or two?
l3ugs.l3unny 21-Dec-16 0:11am    
I went to 40+ tutorials already. But I just figured out myself. I just call the function in my class and it works.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900