PC Review


Reply
Thread Tools Rate Thread

display new rec in datagrid on mdi form?

 
 
Adda
Guest
Posts: n/a
 
      6th Apr 2004
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
 
Reply With Quote
 
 
 
 
Adda
Guest
Posts: n/a
 
      6th Apr 2004
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

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
>.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When to display a tooltip in Win Form Datagrid mfleet1973@yahoo.ca Microsoft VB .NET 1 29th Sep 2006 05:44 PM
How to display data on a Windows form (without using a datagrid)?.. Peter Demeyer Microsoft Dot NET Framework Forms 3 24th Sep 2006 09:30 PM
How to Display images in a Windows Form DataGrid =?Utf-8?B?VmFs?= Microsoft C# .NET 1 12th Sep 2005 02:39 PM
display data in a DataGrid - update using a form Mike Microsoft VB .NET 1 4th Aug 2005 01:06 PM
Can't display dataset in windows form datagrid =?Utf-8?B?dml0YQ==?= Microsoft Dot NET Framework Forms 1 28th Mar 2005 07:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:42 PM.