Click here to Skip to main content
15,912,504 members
Home / Discussions / C#
   

C#

 
AnswerRe: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code Pin
BobJanova11-Jul-12 2:45
BobJanova11-Jul-12 2:45 
GeneralRe: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code Pin
manikantaer11-Jul-12 17:45
manikantaer11-Jul-12 17:45 
AnswerRe: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code Pin
Wes Aday11-Jul-12 3:03
professionalWes Aday11-Jul-12 3:03 
AnswerRe: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code Pin
Dave Kreskowiak11-Jul-12 4:29
mveDave Kreskowiak11-Jul-12 4:29 
AnswerRe: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code Pin
Luc Pattyn11-Jul-12 4:46
sitebuilderLuc Pattyn11-Jul-12 4:46 
QuestionException: Syntax Error in INSERT TO. Pin
kaycey9011-Jul-12 2:37
kaycey9011-Jul-12 2:37 
AnswerRe: Exception: Syntax Error in INSERT TO. Pin
Pete O'Hanlon11-Jul-12 2:42
mvePete O'Hanlon11-Jul-12 2:42 
AnswerRe: Exception: Syntax Error in INSERT TO. Pin
BobJanova11-Jul-12 2:43
BobJanova11-Jul-12 2:43 
GeneralRe: Exception: Syntax Error in INSERT TO. Pin
PIEBALDconsult11-Jul-12 3:30
mvePIEBALDconsult11-Jul-12 3:30 
GeneralRe: Exception: Syntax Error in INSERT TO. Pin
Richard Andrew x6411-Jul-12 5:25
professionalRichard Andrew x6411-Jul-12 5:25 
GeneralRe: Exception: Syntax Error in INSERT TO. Pin
BobJanova11-Jul-12 6:29
BobJanova11-Jul-12 6:29 
GeneralRe: Exception: Syntax Error in INSERT TO. Pin
Richard Andrew x6411-Jul-12 8:18
professionalRichard Andrew x6411-Jul-12 8:18 
GeneralRe: Exception: Syntax Error in INSERT TO. Pin
Pete O'Hanlon11-Jul-12 8:35
mvePete O'Hanlon11-Jul-12 8:35 
GeneralRe: Exception: Syntax Error in INSERT TO. Pin
BobJanova11-Jul-12 23:21
BobJanova11-Jul-12 23:21 
AnswerRe: Exception: Syntax Error in INSERT TO. Pin
PIEBALDconsult11-Jul-12 3:37
mvePIEBALDconsult11-Jul-12 3:37 
QuestionPassing an object through different window classes in Windows Forms Pin
nstk11-Jul-12 0:55
nstk11-Jul-12 0:55 
AnswerRe: Passing an object through different window classes in Windows Forms Pin
Pete O'Hanlon11-Jul-12 1:02
mvePete O'Hanlon11-Jul-12 1:02 
GeneralRe: Passing an object through different window classes in Windows Forms Pin
nstk11-Jul-12 3:47
nstk11-Jul-12 3:47 
GeneralRe: Passing an object through different window classes in Windows Forms Pin
DaveyM6911-Jul-12 4:02
professionalDaveyM6911-Jul-12 4:02 
GeneralRe: Passing an object through different window classes in Windows Forms Pin
nstk12-Jul-12 1:36
nstk12-Jul-12 1:36 
GeneralRe: Passing an object through different window classes in Windows Forms Pin
nstk12-Jul-12 1:44
nstk12-Jul-12 1:44 
AnswerRe: Passing an object through different window classes in Windows Forms Pin
BobJanova11-Jul-12 2:41
BobJanova11-Jul-12 2:41 
There's two common approaches I use for modal dialogs. The first is to write a method in StudentsDataForm (yes I just renamed your class Smile | :) ) which takes the Student, shows the form and returns a modified version:

public Student EditStudent(Student input){
 this.firstNameTextBox.Text = input.FirstName;
 // ... etc to copy data into other controls
 // you could also use data binding
 if(DialogResult.OK == ShowDialog()){
  Student result = new Student();
  result.FirstName = firstNameTextBox.Text;
  // etc
  return result;
 } else return input;
}


There's also a variant of this where you update the input object in place, and return the DialogResult, which you can use if you always want the data object to be updated by the form when OK is used.

The second way is to have a property in the second form:
public Student Student {
 get {
  Student student = new Student();
  student.FirstName = firstName.Text;
  // etc
  return student;
 }
 set {
  firstName.Text = value.FirstName;
  // etc
 }
}


Then you push the data into the form, and use the data from it if the user pressed OK:
studentDataForm.Student = someStudent;
if(DialogResult.OK == studentDataForm.ShowDialog(this)){
 // Do something with studentDataForm.Student to store the changed data
}

GeneralRe: Passing an object through different window classes in Windows Forms Pin
nstk14-Jul-12 7:40
nstk14-Jul-12 7:40 
QuestionData to and from object? Pin
Ronnie_B11-Jul-12 0:55
Ronnie_B11-Jul-12 0:55 
QuestionShared memory Applicaion <->Service Pin
Sebastian_G11-Jul-12 0:07
Sebastian_G11-Jul-12 0:07 

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.