|
-
Sep 4th, 2016, 07:04 AM
#1
Thread Starter
Member
Cannot call function within dynamically created form
Hey guys,
Hoping someone can help with this problem, its killing me at the moment.
I've got a form called main which has on it a datagridview listing tickets from a database.
when a row is doubleclicked, i create a new instance of form 'TicketDetails' like so...
Code:
Dim ThisTicket as new TicketDetails
Show.ThisTicket()
Within 'ThisTicket' there is another datagridview showing the history of the ticket as well as options (called as 'ticketupdate.showdialog') for adding updates.
There is a public function called 'PopulateHistory' within 'TicketDetails' which I call on event ThisTicket.shown.
That works great when you first open ThisTicket, but no matter what I try, I cannot seem to call ThisTicket.populatehistory() from one of my update forms.
I have a 'Confirm Update' button on the ticketupdate form and am trying this...
Code:
Private Sub btnConfirmUpdate_Click(sender As Object, e As EventArgs) Handles btnConfirmUpdate.Click
main.writesql(main.escapechars(internalupdateinput.text))
internalupdateinput.Text = ""
ThisTicket.populatehistory()
Me.Close()
End Sub
But all I get is
'ThisTicket' is not declared or may be inaccessable due to its protection level
The idea is that you open a ticket to view its details and when you submit an update via the updateform, the updateform closes and the dgv for history in ThisTicket refreshes.
It worked fine when I was just using 'TicketDetails.show', but I need TicketDetails to be a multi-instance form.
Can anyone help me out with how I would call back to this function from another form?
Massive thanks in advance for any help!
Last edited by john.muckley; Sep 4th, 2016 at 07:13 AM.
Reason: added code that errors
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|