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

Refreshing a Datagrid from another form.

Hi all.

I want to refresh a Datagrid from another form.

For Example I have a Datagrid in that I want to edit data. The user
has the ability to press a button to change these data.
A new Form opens and the user changes the data. After that he saves
the changes and the current form is closing and the old form with the
datagrid gets the focus again.

At the point the user is saving the data I want to refresh the data in
the form with the datagrid.

Could you please tell me a way to do that? Thank you very much.

Kind regards,
SePp
Feb 6 '08 #1
2 5851
Hi,
You can make the grid public (not the best option) so that the other form
has access to it.

A better approach though is to make a public method available which in turn
would update the grid (and any other controls in the form)

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"SePp" <C_*******@gmx.dewrote in message
news:eb**********************************@k39g2000 hsf.googlegroups.com...
Hi all.

I want to refresh a Datagrid from another form.

For Example I have a Datagrid in that I want to edit data. The user
has the ability to press a button to change these data.
A new Form opens and the user changes the data. After that he saves
the changes and the current form is closing and the old form with the
datagrid gets the focus again.

At the point the user is saving the data I want to refresh the data in
the form with the datagrid.

Could you please tell me a way to do that? Thank you very much.

Kind regards,
SePp

Feb 6 '08 #2
On Feb 6, 4:17*pm, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
Hi,

You can make the grid public (not the best option) so that the other form
has access to it.

A better approach though is to make a public method available which in turn
would update the grid (and any other controls in the form)

--
Ignacio Machinhttp://www.laceupsolutions.com
Mobile & warehouse Solutions."SePp" <C_o_z_...@gmx.dewrote in message

news:eb**********************************@k39g2000 hsf.googlegroups.com...
Hi all.
I want to refresh a Datagrid from another form.
For Example I have a Datagrid in that I want to edit data. The user
has the ability to press a button to change these data.
A new Form opens and the user changes the data. After that he saves
the changes and the current form is closing and the old form with the
datagrid gets the focus again.
At the point the user is saving the data I want to refresh the data in
the form with the datagrid.
Could you please tell me a way to do that? Thank you very much.
Kind regards,
SePp- Hide quoted text -

- Show quoted text -

Hm I can't find a way to get it working.
Here an example:

Form1:

Has a combobox I get these data from an OracleDatabase:

something like:

private void load_combobox_1()
{
OracleDataAdapter cmd = new OracleDataAdapter("select *
from ", conn);
cmd.TableMappings.Add("Table", "TABLE1");
DataSet ds = new DataSet("TABLE1");
cmd.Fill(ds);
comboBox_1.DataSource = ds.Tables["TABLE1"];
comboBox_1.ValueMember = "Col1";
comboBox_1.DisplayMember = "col2";
comboBox_1.SelectedIndex = -1;
}
To reload that i have a method:

public void reload_information()
{
load_combobox_1();
}


Now I am opening Form2

Form2 bd = new Form2;
bd.Show();
And atFormClose I want to reload the information in the combobox at
form1:

reload_information();
Here are the way I tried it:

Form1 bd = new Form1()
bd.reload_information();
But this can't work because I generate a new object.
So the big question for me is how do I get the actual Object from
Form1 to reload the information at it.
Something with this. ???
Thank you very much in advance for your information!!!!

Kind regards,
SePp


Feb 8 '08 #3

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

Similar topics

0
by: msnews | last post by:
Hi -- I'm very, very new to ASP.Net, and I've been trying for several days to figure out how to update a datagrid AND refresh it on the client side so that the page doesn't refresh. I've torn my...
2
by: VM | last post by:
How can I display the contents of a datatable in a windows datagrid while the table is being filled? Here's my summarized code: delegate void loadAuditFileToTableDelegate(); private void...
5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
1
by: Hans | last post by:
I have a Windows.Forms.Form containing a DataGrid where the DataSource is a DataView. Everything refreshes fine after adding, deleting or editing rows. When I close the dialog and reopen it with a...
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...
1
by: Jennyfer J Barco | last post by:
Hello I have a datagrid and a linkbuttom in the datagrid that says Picture, every time I click on the link "Picture" my program opens a popup window showing a picture of the item the selected and...
3
by: gsb58 | last post by:
Hi! A mainform is being used to show records from a table in an sql database. A button on the main form will load a new form that allows the user to add, delete, update and search certain...
1
by: SePp | last post by:
Hi all. I want to refresh a Datagrid from another form. (in C# ) For Example I have a Datagrid in that I want to edit data. The user has the ability to press a button to change these data. A...
17
lee123
by: lee123 | last post by:
I know this is a free site and the moderators or anybody don't have to answer if they don't want to.. but if there is someone who knows how to answer this question please help with this one. i...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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,...
0
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...
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
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...

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.