Click here to Skip to main content
15,909,897 members
Home / Discussions / C#
   

C#

 
Questioninsert data from Oracle to MS SQL Pin
Ubun2OS17-Jul-12 5:57
Ubun2OS17-Jul-12 5:57 
AnswerRe: insert data from Oracle to MS SQL PinPopular
Pete O'Hanlon17-Jul-12 6:09
mvePete O'Hanlon17-Jul-12 6:09 
GeneralRe: insert data from Oracle to MS SQL Pin
PIEBALDconsult17-Jul-12 6:41
mvePIEBALDconsult17-Jul-12 6:41 
GeneralRe: insert data from Oracle to MS SQL Pin
Pete O'Hanlon17-Jul-12 8:07
mvePete O'Hanlon17-Jul-12 8:07 
GeneralRe: insert data from Oracle to MS SQL Pin
PIEBALDconsult17-Jul-12 9:27
mvePIEBALDconsult17-Jul-12 9:27 
QuestionCreating subobjects within an object? Pin
Goalie3517-Jul-12 5:43
Goalie3517-Jul-12 5:43 
AnswerRe: Creating subobjects within an object? Pin
Luc Pattyn17-Jul-12 6:40
sitebuilderLuc Pattyn17-Jul-12 6:40 
GeneralRe: Creating subobjects within an object? Pin
BobJanova18-Jul-12 4:38
BobJanova18-Jul-12 4:38 
AnswerRe: Creating subobjects within an object? Pin
Luc Pattyn18-Jul-12 5:22
sitebuilderLuc Pattyn18-Jul-12 5:22 
AnswerRe: Creating subobjects within an object? Pin
TheGreatAndPowerfulOz9-Aug-12 4:26
TheGreatAndPowerfulOz9-Aug-12 4:26 
QuestionCompare Images "before and after" Pin
ToBick16-Jul-12 22:03
ToBick16-Jul-12 22:03 
AnswerRe: Compare Images "before and after" Pin
Eddy Vluggen16-Jul-12 23:13
professionalEddy Vluggen16-Jul-12 23:13 
GeneralRe: Compare Images "before and after" Pin
ToBick17-Jul-12 4:47
ToBick17-Jul-12 4:47 
GeneralRe: Compare Images "before and after" Pin
Eddy Vluggen17-Jul-12 4:53
professionalEddy Vluggen17-Jul-12 4:53 
GeneralRe: Compare Images "before and after" Pin
ToBick17-Jul-12 6:57
ToBick17-Jul-12 6:57 
AnswerRe: Compare Images "before and after" Pin
Eddy Vluggen17-Jul-12 7:52
professionalEddy Vluggen17-Jul-12 7:52 
GeneralRe: Compare Images "before and after" Pin
Pete O'Hanlon17-Jul-12 8:23
mvePete O'Hanlon17-Jul-12 8:23 
AnswerRe: Compare Images "before and after" Pin
Abhinav S16-Jul-12 23:15
Abhinav S16-Jul-12 23:15 
QuestionReturning Instance Issue - Object Reference Not Set Pin
AmbiguousName16-Jul-12 22:00
AmbiguousName16-Jul-12 22:00 
AnswerRe: Returning Instance Issue - Object Reference Not Set Pin
Pete O'Hanlon16-Jul-12 22:16
mvePete O'Hanlon16-Jul-12 22:16 
Without using static, your classes here must be instantiated. I must say though, that your hierarchy is a complete mess. You need to do a rewrite of this - you might possibly want to consider something like this:
C#
public interface IMessage
{
  void ShowMesage();
}
public class MainDialog : IMessage
{
  public MainDialog() {}
  public void ShowMessage()
  {
    MessageBox.Show("Hello");
  }
}

public static class SingleObj
{
  public static void ShowMessage<T>() where T : IMessage, new()
  {
    T dialog = new T();
    dialog.ShowMessage();
  }
}

public class Tab1
{
  public void Function_InTab()
  {
    SingleObj.ShowMessage<MainDialog>();
  }
}
In this code sample, you can see the use of the static modifier to make ShowMessage single instance. More importantly, you can see that we have used generics with constraints to get a somewhat more pleasing design for the case where we simply want to show a message. You can extend and adapt this as to cater for more complex designs, but bear in mind that a single instance class can often be considered to be a code smell - make sure you use it wisely.

*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

QuestionRe: Returning Instance Issue - Object Reference Not Set Pin
Eddy Vluggen16-Jul-12 23:16
professionalEddy Vluggen16-Jul-12 23:16 
AnswerRe: Returning Instance Issue - Object Reference Not Set Pin
AmbiguousName16-Jul-12 23:25
AmbiguousName16-Jul-12 23:25 
QuestionRe: Returning Instance Issue - Object Reference Not Set Pin
Eddy Vluggen16-Jul-12 23:30
professionalEddy Vluggen16-Jul-12 23:30 
AnswerRe: Returning Instance Issue - Object Reference Not Set Pin
AmbiguousName16-Jul-12 23:37
AmbiguousName16-Jul-12 23:37 
AnswerRe: Returning Instance Issue - Object Reference Not Set Pin
Eddy Vluggen16-Jul-12 23:52
professionalEddy Vluggen16-Jul-12 23:52 

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.