How can I design this approach ?

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I got a invoice form , and toolbar, as the user click search button. I want
to prompt a little window with one textbox , "OK" button and "Cancel"
button.
as the user input the invoice_no, press OK , it will search the record . if
there is not record .(prompt the messagebox) and the focus will still keep
on the textbox.

Now. I got many forms which need to use this "little window" . BUT I don't
want to create these forms and "put" different codes in the "OK" button .

I would like to put all the codes in (invoice form) ,
How can I do this--->"as the user press the OK button in little window,
little window will call the invoiceform's method but not itself'

Does anyone understand my silly question ??
Thanks a lot
 
//Search Form
Public Class Search

Inherits System.Windows.Forms.Form

Private MyParentFormValue As Form1

Public Property MyParentForm() As Form1

Get

Return MyParentFormValue

End Get

Set(ByVal Value As Form1)

MyParentFormValue = Value

End Set

End Property

#Region " Windows Form Designer generated code "

Public Sub New(ByVal f As Form1)

MyBase.New()

Me.MyParentForm = f

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

'if 'MyParentForm.MySearchMethod( textbox1.text ) then

Me.DialogResult = System.Windows.Forms.DialogResult.OK

Me.Close()

'Else

TextBox1.Focus()

Label1.Text = "not Found"

'End if

End Sub



//Calling Form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim f As New Search(Me)

f.ShowDialog()

End Sub


--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
Thanks OHM, but ... Private MyParentFormValue As Form1
What is form1 ?? (myinvoice form ??)
 
Yes, thats just an example

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 

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

Back
Top