I have a main form with a datagrid.
When I add I click a add button and another form (customer form) will open. I enter in the new data and click add customer button. The customer is saved in the database. After the another function will be called to get the new customer and fill a dataset for the datagrid datasource. However, the datagrid form does not show the new customer. I have to close the main form first and then re-open it.
This is the code i am using code for the add customer form.
I am using visual basic 2005 and sql server 2005. The datagrid is an ultragrid form infragisitics. But still functions the same way as a normal windows datagrid.
Expand|Select|Wrap|Line Numbers
- Private Sub btnAddNewContact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNewContact.Click
- Dim objInsertNewContact As New BL_Contacts()
- clientID = objInsertNewContact.InsertNewContact(clientID, txtContactName.Text, txtPhoneNumber.Text, txtExtensionNumber.Text, txtAdditionalNumber.Text, txtEmail.Text, txtPosition.Text)
- Me.BindDataGrid()
- End Sub
- Public Sub BindDataGrid()
- Dim objNewCustomer As New NewCustomer()
- Dim displayClientDetails As New BL_Clients()
- Dim ds As New DataSet()
- ds = displayClientDetails.getClients
- objNewCustomer.ultGrdNewContacts.DataSource = ds.Tables(0).DefaultView
- objNewCustomer.ultGrdNewContacts.DataBind()
- objNewCustomer.ultGrdNewContacts.Refresh()
- End Sub
Steve