Click here to Skip to main content
15,888,803 members
Home / Discussions / C#
   

C#

 
JokeRe: plz help with ghe following.... Pin
Mycroft Holmes21-Aug-12 20:07
professionalMycroft Holmes21-Aug-12 20:07 
AnswerRe: plz help with ghe following.... Pin
OriginalGriff21-Aug-12 21:09
mveOriginalGriff21-Aug-12 21:09 
GeneralRe: plz help with ghe following.... Pin
joy madalane21-Aug-12 21:27
joy madalane21-Aug-12 21:27 
GeneralRe: plz help with ghe following.... Pin
OriginalGriff21-Aug-12 21:47
mveOriginalGriff21-Aug-12 21:47 
QuestionDifferent object depending on variable value Pin
suzyb21-Aug-12 3:50
suzyb21-Aug-12 3:50 
AnswerRe: Different object depending on variable value Pin
OriginalGriff21-Aug-12 4:06
mveOriginalGriff21-Aug-12 4:06 
GeneralRe: Different object depending on variable value Pin
Pete O'Hanlon21-Aug-12 4:31
mvePete O'Hanlon21-Aug-12 4:31 
AnswerRe: Different object depending on variable value Pin
Pete O'Hanlon21-Aug-12 4:40
mvePete O'Hanlon21-Aug-12 4:40 
The big issue you have here is that properties in the derived type aren't present in the base type, so you can't really declare app as BaseApplication. Well, you can, but you need to cast to the derived type to access the properties. What you could do is something like this though:
C#
BaseApplication app = null;
switch (courseType)
{
  case "31":
    app = CreateStudentApplication();
    break;
}

if (app != null)
{
  app.Save();
}
....

private StudentApplication CreateStudentApplication()
{
  StudentApplication app = new StudentApplication();
  SetBaseInformation(app);
  app.SupportNeeds = SupportNeeds.Text;
  return app;
}

private void SetBaseInformation(BaseApplication application)
{
  application.FirstName = FirstName.Text;
  application.LastName = LastName.Text;
}

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

AnswerRe: Different object depending on variable value Pin
Eddy Vluggen21-Aug-12 4:53
professionalEddy Vluggen21-Aug-12 4:53 
GeneralRe: Different object depending on variable value Pin
suzyb21-Aug-12 5:40
suzyb21-Aug-12 5:40 
GeneralRe: Different object depending on variable value Pin
Eddy Vluggen21-Aug-12 5:46
professionalEddy Vluggen21-Aug-12 5:46 
AnswerRe: Different object depending on variable value Pin
jschell22-Aug-12 8:50
jschell22-Aug-12 8:50 
QuestionAutomatically optimize all tables in a MySQL database Pin
Alagiri.periyasamy@merrillcorp.com21-Aug-12 1:46
Alagiri.periyasamy@merrillcorp.com21-Aug-12 1:46 
AnswerRe: Automatically optimize all tables in a MySQL database Pin
Eddy Vluggen21-Aug-12 1:51
professionalEddy Vluggen21-Aug-12 1:51 
GeneralRe: Automatically optimize all tables in a MySQL database Pin
Alagiri.periyasamy@merrillcorp.com21-Aug-12 2:05
Alagiri.periyasamy@merrillcorp.com21-Aug-12 2:05 
AnswerRe: Automatically optimize all tables in a MySQL database Pin
Eddy Vluggen21-Aug-12 2:17
professionalEddy Vluggen21-Aug-12 2:17 
QuestionLinq - Conditions for two categories in parallel Pin
Ronenb21-Aug-12 1:18
Ronenb21-Aug-12 1:18 
AnswerRe: Linq - Conditions for two categories in parallel Pin
Wayne Gaylard21-Aug-12 3:21
professionalWayne Gaylard21-Aug-12 3:21 
AnswerMessage Removed Pin
21-Aug-12 3:40
professionalN_tro_P21-Aug-12 3:40 
GeneralRe: Linq - Conditions for two categories in parallel Pin
Ronenb22-Aug-12 20:54
Ronenb22-Aug-12 20:54 
GeneralRe: Linq - Conditions for two categories in parallel Pin
Ronenb26-Aug-12 21:59
Ronenb26-Aug-12 21:59 
GeneralMessage Removed Pin
27-Aug-12 2:41
professionalN_tro_P27-Aug-12 2:41 
GeneralRe: Linq - Conditions for two categories in parallel Pin
Ronenb27-Aug-12 5:46
Ronenb27-Aug-12 5:46 
GeneralDynamic Keyword Pin
gopesh201020-Aug-12 23:12
gopesh201020-Aug-12 23:12 
GeneralRe: Dynamic Keyword Pin
Pete O'Hanlon20-Aug-12 23:35
mvePete O'Hanlon20-Aug-12 23:35 

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.