473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

reloading a datagrid with new data from a dataset

Hello,

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
  1. Private Sub btnAddNewContact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNewContact.Click
  2.  
  3.         Dim objInsertNewContact As New BL_Contacts()
  4.         clientID = objInsertNewContact.InsertNewContact(clientID, txtContactName.Text, txtPhoneNumber.Text, txtExtensionNumber.Text, txtAdditionalNumber.Text, txtEmail.Text, txtPosition.Text)
  5.  
  6.         Me.BindDataGrid()
  7.  
  8.     End Sub
  9.     Public Sub BindDataGrid()
  10.         Dim objNewCustomer As New NewCustomer()
  11.         Dim displayClientDetails As New BL_Clients()
  12.         Dim ds As New DataSet()
  13.  
  14.         ds = displayClientDetails.getClients
  15.         objNewCustomer.ultGrdNewContacts.DataSource = ds.Tables(0).DefaultView
  16.  
  17.         objNewCustomer.ultGrdNewContacts.DataBind()
  18.         objNewCustomer.ultGrdNewContacts.Refresh()
  19.  
  20.     End Sub
  21.  
Many thanks in advance,

Steve
Oct 12 '06 #1
0 945

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the...
3
by: Doug | last post by:
Hi I have the following code (not mine) that populates a datagrid with some file names. But I want to replace the datagrid with a combo box. private void OnCurrentDataCellChanged(object sender,...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: Rod | last post by:
I posted a message to this group yesterday asking how to pass parameters to a web form that is the source of an IFrame on a parent web form. I've gotten my answer, and it works. Thanks! Now I...
2
by: Bennett Haselton | last post by:
I know how to create a DataAdapter that loads data from a data source into a table in a typed DataSet, and how to set the DataSource and DataMember properties of a DataGrid so that at run time it...
3
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
0
by: steve1rm | last post by:
Hello, 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...
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.