Click here to Skip to main content
15,894,337 members
Home / Discussions / C#
   

C#

 
GeneralRe: Retrieving Data From Form2 Pin
AmbiguousName12-Dec-11 23:13
AmbiguousName12-Dec-11 23:13 
GeneralRe: Retrieving Data From Form2 Pin
Pete O'Hanlon12-Dec-11 23:35
mvePete O'Hanlon12-Dec-11 23:35 
AnswerRe: Retrieving Data From Form2 Pin
Subin Mavunkal12-Dec-11 23:52
Subin Mavunkal12-Dec-11 23:52 
GeneralRe: Retrieving Data From Form2 Pin
Pete O'Hanlon13-Dec-11 0:14
mvePete O'Hanlon13-Dec-11 0:14 
AnswerRe: Retrieving Data From Form2 Pin
DaveyM6913-Dec-11 1:04
professionalDaveyM6913-Dec-11 1:04 
GeneralRe: Retrieving Data From Form2 Pin
Subin Mavunkal13-Dec-11 2:03
Subin Mavunkal13-Dec-11 2:03 
AnswerRe: Retrieving Data From Form2 Pin
BillWoodruff13-Dec-11 12:14
professionalBillWoodruff13-Dec-11 12:14 
AnswerRe: Retrieving Data From Form2 Pin
BobJanova13-Dec-11 23:11
BobJanova13-Dec-11 23:11 
For any sort of complex application, both forms should be looking at some non-UI data model. So all Form2 should have to 'pass back' to Form1 is a selected index or an identifier for the model object that corresponds to the selected row.

Without knowing what the UI context of these two forms is (does Form2 spawn Form1 as an editor? are both forms top level forms? etc) it's hard to be more detailed than that. But the key point is that the data grid on Form2 should be a view on an IList<YourDataModelClass> (well, possibly, a BindingList or a BindingSource on a List) and the various controls on Form1 should be a view on the properties of a YourDataModelClass. You can achieve this with data binding or manually setting properties, and you'll probably want either the model class or a view-model to implement change notification (INotifyPropertyChanged) so that when you update things from Form1, Form2 also refreshes its view. If you're using WPF then you can just use Binding attributes in the XAML.

As Bill says this is a pretty common question in Q&A so you might want to search there and have a look at some of the recommended answers.
QuestionSeriously? user-defined conversions to or from an interface are not allowed Pin
Alaric_12-Dec-11 9:16
professionalAlaric_12-Dec-11 9:16 
AnswerRe: Seriously? user-defined conversions to or from an interface are not allowed Pin
BobJanova14-Dec-11 5:09
BobJanova14-Dec-11 5:09 
QuestionTCPClient and TCPListener Pin
michaelgr112-Dec-11 2:38
michaelgr112-Dec-11 2:38 
AnswerRe: TCPClient and TCPListener Pin
jschell12-Dec-11 8:32
jschell12-Dec-11 8:32 
GeneralRe: TCPClient and TCPListener Pin
michaelgr112-Dec-11 8:57
michaelgr112-Dec-11 8:57 
GeneralRe: TCPClient and TCPListener Pin
Addy Tas12-Dec-11 11:44
Addy Tas12-Dec-11 11:44 
GeneralRe: TCPClient and TCPListener Pin
jschell13-Dec-11 8:32
jschell13-Dec-11 8:32 
QuestionWriting a 6502 cross assembler in c# Pin
Derek Henderson12-Dec-11 0:27
Derek Henderson12-Dec-11 0:27 
AnswerRe: Writing a 6502 cross assembler in c# Pin
Luc Pattyn12-Dec-11 1:05
sitebuilderLuc Pattyn12-Dec-11 1:05 
GeneralRe: Writing a 6502 cross assembler in c# Pin
Derek Henderson12-Dec-11 1:19
Derek Henderson12-Dec-11 1:19 
GeneralRe: Writing a 6502 cross assembler in c# Pin
harold aptroot12-Dec-11 4:52
harold aptroot12-Dec-11 4:52 
AnswerRe: Writing a 6502 cross assembler in c# Pin
Richard MacCutchan12-Dec-11 5:01
mveRichard MacCutchan12-Dec-11 5:01 
GeneralRe: Writing a 6502 cross assembler in c# Pin
Derek Henderson12-Dec-11 5:06
Derek Henderson12-Dec-11 5:06 
AnswerRe: Writing a 6502 cross assembler in c# Pin
jschell12-Dec-11 8:34
jschell12-Dec-11 8:34 
Questionestablishing a connection error for mssql 2005 Pin
Member 808991411-Dec-11 23:53
Member 808991411-Dec-11 23:53 
AnswerRe: establishing a connection error for mssql 2005 Pin
thatraja12-Dec-11 3:03
professionalthatraja12-Dec-11 3:03 
QuestionEventType : clr20r3 ,system.windows.markup.xamlparse error Pin
sgkin11-Dec-11 22:24
sgkin11-Dec-11 22:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.