.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 27th, 2004, 02:52 AM
ipsita_mohanty ipsita_mohanty is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 ipsita_mohanty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Passing/Accessing data from one form in another form(C#.NET)

Hi,
I have a muliple form application using WIndows forms in C#.NET. Every time I am done with entering data on the form, and want to proceed to the next form I do: eg:
System.Windows.Forms.Form form2_=
new form2();
form2_.Show();
1) How to access data from form1 (that is the previous screen) in Form2?
(Someone wrote in an earlier query that in this case we have to change the access control to 'Protected internal'.)
Can you please be more elaborate and show with a code example, as to how to set it and where?
2)If we do a new form to navigate to the next form, say if we have a "Back" button, do we have to create a new instance to come back again? In this case the prvious data that we had entered will be lost. Is there a way to navigate between forms, and maintain the state of the previous form?

I would appreciate any kind of help. Also I am a novice, so please be elaborate

Thanks
IM

Reply With Quote
  #2  
Old November 2nd, 2005, 12:07 AM
ghiath ghiath is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 2 ghiath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 0
navigate between form

hello ,
i have a form with a datagrid in it named form 2, and now i want to update the information in grid table,i design a new form named form 3,and use text box control to update the database table.how can i refresh the iformation in datagrid
in form 2.

Reply With Quote
  #3  
Old November 2nd, 2005, 12:10 AM
ghiath ghiath is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2005
Posts: 2 ghiath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 0
i have a form (named form 2) with a datagrid in it.for updating the information in grid i use another form named form 3. after entering data in form 3 ,how can i navigate to form2 and refresh datagrid?

Reply With Quote
  #4  
Old January 7th, 2006, 07:50 AM
vimalraj vimalraj is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 30 vimalraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 14 m 39 sec
Reputation Power: 14
Hi,
when you create the new form (say Form2) pass an instance of Form1 into that. So that inside Form2 you can call the methods of Form1 using that instance.

Happy Programming,
Vimal

Reply With Quote
  #5  
Old January 7th, 2006, 07:57 AM
vimalraj vimalraj is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 30 vimalraj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 14 m 39 sec
Reputation Power: 14
Hi,
you can declare a control like this to make it proteced internal.just change the private keyword to protected internal.

ex:
protected internal System.Windows.Forms.DataGrid dataGrid1;

Happy Programming,
Vimal

Reply With Quote
  #6  
Old December 15th, 2006, 07:30 AM
swapnass swapnass is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Posts: 1 swapnass User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 5 sec
Reputation Power: 0
make the control modifier as public. then create object of the form of which controls u want to access in the form where u want to access that controls.using that object u can easily access

Reply With Quote
  #7  
Old June 11th, 2008, 09:12 AM
shaning shaning is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 1 shaning User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 38 sec
Reputation Power: 0
Question Can't access to DataGridView of another Form

In Form1, there is a DataGridView (dataGridView1) with data populated, and several textboxes. All of the controls's modifiers are public.
In Form2, I can get the values of the f1.textBox1.text of Form1 Form1 f1 = new Form1(), and dataGridView1.Name, but NOT f1.dataGridView1.Rows.Count as well as the values in the cell.
How can this problem be solved? Thanks.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Passing/Accessing data from one form in another form(C#.NET)


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap