How do I Overload Show() Method?

P

Paul Fairless

Could someone please explain how I overload the Show() method of a form?

Suppose I select a record from a datagrid on Form1, then I want to show the
details of the selected record by opening Form2 using say the CustomerID as
an 'argument' to the Show method.

So, in Form1 I would have code such as:

Sub GetSelectedRecord()
Form2.Show(CustomerID)
Me.Close()
End Sub

.... and in Form2 I woudl have code such as:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
..... code to read a record from a database using the CustomerID
End Sub

Many Thanks

Paul.
 
A

Armin Zingler

Paul Fairless said:
Could someone please explain how I overload the Show() method of a
form?

Suppose I select a record from a datagrid on Form1, then I want to
show the details of the selected record by opening Form2 using say
the CustomerID as an 'argument' to the Show method.

So, in Form1 I would have code such as:

Sub GetSelectedRecord()
Form2.Show(CustomerID)
Me.Close()
End Sub

... and in Form2 I woudl have code such as:

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
..... code to read a record from a database using the
CustomerID
End Sub

Private m_IDCustomer As Integer

Public Overloads Sub Show(ByVal IDCustomer As Integer)
m_IDCustomer = IDCustomer
'you can place the "code to read a record from a database using the"
'here or in the load event.

MyBase.Show()
End Sub



--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 

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