Master - Transaction Form Problem.

PatelNehal4u

Active member
Joined
Apr 6, 2009
Messages
25
Programming Experience
1-3
I am creating a master form of CITY and another form is AREA, now when i add any record in AREA form i select the CITY from the listview, which are entered in CITY master form, but if the city is not available the user click a small button for CITY form which bring the CITY form, now both forms are open and i am entering city details in CITY form. When i click Save button of CITY form i want that change reflect in AREA form. So how can i handle that reflect in AREA form without any refresh button?
 
You could open the CITY form by showdialog() then when the user finishes and closes the form you can finish processing on the AREA form. This might be along the lines your looking for:

'Area form
VB.NET:
Public Class frmArea
    Private Sub frmArea_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        FillListView()

    End Sub

    Private Sub btnGetCityInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetCityInfo.Click
        Dim frmShowCity As New frmCity

        If frmShowCity.ShowDialog() = Windows.Forms.DialogResult.OK Then
            're call the procedure that will fill the listview with data again
            ' this should now include what you updated on the City form.
            FillListView()
        End If
    End Sub

    Private Sub FillListView()
        'Clear the list View of data
        lsvCities.Items.Clear()

        'Fills the List View with City data


    End Sub
End Class

'City form
VB.NET:
Public Class frmCity

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        If Not String.IsNullOrEmpty(txtName.Text) AndAlso Not String.IsNullOrEmpty(txtZip.Text) Then
            'update whereever the information is stored for cities
            ' whether it is a database, xml, text, etc......

            'then set the dialog result, which will be processed in the Area form
            Me.DialogResult = Windows.Forms.DialogResult.OK
            Me.Close()
        End If
    End Sub
End Class
 
Back
Top