473,890 Members | 5,293 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2329
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.Ta bles("tbl1").Ro ws.Add(dr)
frm.dataAdapter 1.Fill(dataset1 , "tbl1")
End Sub

I also tried refilling dataset1 with
frm.dataAdapter 1.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.Ta bles("tbl1").Ro ws.Add(dr)
frm.dataAdapter 1.Fill(dataset1 , "tbl1")
End Sub

I also tried refilling dataset1 with
frm.dataAdapter 1.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
2425
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 of the selected row in textboxes on dialog that execute by the user press a button. The following code works if I do not sort the datagrid before I press the button to bring up the dialog. It is when I sort it the datagrid I have the issue ...
18
3358
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 columns, "scode" and "sname", as 1 column (if not possible then 2 columns will be fine) in the listbox. Can the listbox display 2 columns information from the dataset and how can I do that? Also, I set the property of the listbox to selectionmode...
3
4241
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 datatable feeding the datagrid control. Both are of the DateTime Type. How do I get the time field to display only the Time, and not the date, which is apparently the default.
0
1224
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 object is producing data because it works in a Windows form application). Here is my WebForm: ---------------------------------------- <%@ Register TagPrefix="allLevels" TagName="mainHeader" Src="mainHeader.ascx" %>
0
1114
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 object is producing data because it works in a Windows form application). Here is my WebForm: ---------------------------------------- <%@ Register TagPrefix="allLevels" TagName="mainHeader" Src="mainHeader.ascx" %>
2
570
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 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...
3
1942
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 table, the cell from the old table remains visible, infront of the new tables data...?! I have tried 'datagrid.refresh', 'DataGrid1.DataSource = nothing' and all sort of tricks to try and update the display, but to no avail. My code looks like...
2
1745
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 values in datagrid of first form through this 2nd form.my problem is,in 2nd form,if i enter letter a in findtextbox and i click find button means,i want to display the values automatically (assyst in companynametextbox,vijay in...
2
2805
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 still getting used to .net I can successfully upload images and other data into the SQL Database, I'm currently storing RecordID, File Name, Type of File (mime), File Size, and File Data. I can retreive non binary data to a datagrid but I cannot...
2
3690
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 different item no in it..then, these records will be saved in a temporary datatable (which i made in a separate class, the name is WBASKET)...The item nos of these records will be displayed in a combobox, say item1, item2, etc.. then,i have a datagrid...
0
9979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9823
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11234
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10924
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9637
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7170
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5854
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4681
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4275
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.