473,320 Members | 1,804 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,320 software developers and data experts.

display new rec in datagrid on mdi form?

I have a datagrid on a parent mdi form with connection1,
dataAdapter1, dataset1. From a main menu I call a child
form where I enter new data and update dataset1 with
dataAdapter2, connection2 on the child form, but the same
dataset (dataset1). The data is stored in a sql server DB
and is being stored correctly, but the new record is not
being displayed in the datagrid on the parent form. If I
close the app and re-open it, I can see the new record in
the datagrid. How can I refresh the datagrid on the
parent form without having to close and re-open the app?

TIA
Adda
Nov 20 '05 #1
2 2294
I came up with two solutions. One is to add an additional
menu to the parent form where I clear the dataset and
refill it with the dataAdapter for the parent form. My
other solution is to open the child form as a Dialog form
(modal form) and use the Parent form dataset and
dataAdapter to add the new row. I also tried referencing
the Parent from dataset in the child form . But this did
not seem to update the datagrid in the parent form even
though it did add the record to the database.

Sub AddNewRec(...)...
Dim dr as datarow, frm as New ParentFrm
dr=frm.dataset1.Tables("tbl1").NewRow()
dr(0) = txt0.Text
dr(1) = txt1.Text
frm.dataset1.Tables("tbl1").Rows.Add(dr)
frm.dataAdapter1.Fill(dataset1, "tbl1")
End Sub

I also tried refilling dataset1 with
frm.dataAdapter1.Fill... from the child form. But no
effect. Is it even possible to control a parent form from
a child form like this?

-----Original Message-----
I have a datagrid on a parent mdi form with connection1,
dataAdapter1, dataset1. From a main menu I call a child
form where I enter new data and update dataset1 with
dataAdapter2, connection2 on the child form, but the same
dataset (dataset1). The data is stored in a sql server DBand is being stored correctly, but the new record is not
being displayed in the datagrid on the parent form. If I
close the app and re-open it, I can see the new record in
the datagrid. How can I refresh the datagrid on the
parent form without having to close and re-open the app?

TIA
Adda
.

Nov 20 '05 #2
I came up with two solutions. One is to add an additional
menu to the parent form where I clear the dataset and
refill it with the dataAdapter for the parent form. My
other solution is to open the child form as a Dialog form
(modal form) and use the Parent form dataset and
dataAdapter to add the new row. I also tried referencing
the Parent from dataset in the child form . But this did
not seem to update the datagrid in the parent form even
though it did add the record to the database.

Sub AddNewRec(...)...
Dim dr as datarow, frm as New ParentFrm
dr=frm.dataset1.Tables("tbl1").NewRow()
dr(0) = txt0.Text
dr(1) = txt1.Text
frm.dataset1.Tables("tbl1").Rows.Add(dr)
frm.dataAdapter1.Fill(dataset1, "tbl1")
End Sub

I also tried refilling dataset1 with
frm.dataAdapter1.Fill... from the child form. But no
effect. Is it even possible to control a parent form from
a child form like this?

-----Original Message-----
I have a datagrid on a parent mdi form with connection1,
dataAdapter1, dataset1. From a main menu I call a child
form where I enter new data and update dataset1 with
dataAdapter2, connection2 on the child form, but the same
dataset (dataset1). The data is stored in a sql server DBand is being stored correctly, but the new record is not
being displayed in the datagrid on the parent form. If I
close the app and re-open it, I can see the new record in
the datagrid. How can I refresh the datagrid on the
parent form without having to close and re-open the app?

TIA
Adda
.

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: kll | last post by:
I have been on newsgroup for week. I have seen anything that will help me. Basically, I have a form with a datagrid that can be sorted or unsorted (it is up to the user). Then, I display the data...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
0
by: DC Gringo | last post by:
I am trying to output simply DataGrid of a coutry listing on a web form via a business object and XML web service...I receive no errors but no table HTML either. (I know the service and business...
0
by: DC Gringo | last post by:
I am trying to output simply DataGrid of a coutry listing on a web form via a business object and XML web service...I receive no errors but no table HTML either. (I know the service and business...
2
by: Adda | last post by:
I have a datagrid on a parent mdi form with connection1, dataAdapter1, dataset1. From a main menu I call a child form where I enter new data and update dataset1 with dataAdapter2, connection2 on...
3
by: JJ | last post by:
I have a datagrid on my form that displays its data from various tables within a specified dataset. That all works correclty. However, when one cell is selected prior to changed the displayed...
2
by: sathyan8294 | last post by:
i am using dotnet 2003.i am doing my project in vb.net windows application.i have two form in my project.first form is datagrid .In second form label and textboxes are avilable to save the entering...
2
by: pozze | last post by:
Hi, I need to display images and other record information retrieved from an SQL 2005 database in a datagrid on a web page. I'm coding in VB .net I have recently changed over from VB ASP and i'm...
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.