Click here to Skip to main content
15,881,757 members
Home / Discussions / C#
   

C#

 
AnswerRe: Delete in Richtextbox? Pin
Eddy Vluggen24-Feb-09 23:35
professionalEddy Vluggen24-Feb-09 23:35 
Question[Message Deleted] Pin
Prajeesh24-Feb-09 23:47
Prajeesh24-Feb-09 23:47 
AnswerRe: Delete in Richtextbox? Pin
Eddy Vluggen25-Feb-09 0:11
professionalEddy Vluggen25-Feb-09 0:11 
General[Message Deleted] Pin
Prajeesh25-Feb-09 0:23
Prajeesh25-Feb-09 0:23 
GeneralRe: Delete in Richtextbox? Pin
Eddy Vluggen25-Feb-09 1:06
professionalEddy Vluggen25-Feb-09 1:06 
Answer[Message Deleted] Pin
Prajeesh26-Feb-09 16:39
Prajeesh26-Feb-09 16:39 
GeneralRe: Delete in Richtextbox? Pin
Eddy Vluggen26-Feb-09 21:06
professionalEddy Vluggen26-Feb-09 21:06 
QuestionStront typing error Pin
kanchoette24-Feb-09 22:17
kanchoette24-Feb-09 22:17 
I am comparing data fields, and setting values where differences occur like so:

foreach (DebtorDataSet.DebtorRow row in debtorDataSet.Debtor.Rows)
  {
  // ----- Debtors ----------------
    if (row.CorrespondenceSource == "D" || row.CorrespondenceSource == "J")
      {
        if (row.HouseName != row.CorrespondenceHouseName)
           {
             row.CorrespondenceHouseName = row.HouseName;
           }
        if (row.NoStreet != row.CorrespondenceNoStreet)
           {
             row.CorrespondenceNoStreet = row.NoStreet;
           }
      }
  }


but I am getting an error due to underlying data being DBnull.
Elsewhere in my project I use a helper class for such situations:

public static object getDefaultIfDBNull(object obj, TypeCode typeCode)
        {
            //If object is dbnull then return the default for that type.
            //Otherwise just return the orginal value.

            if (obj == DBNull.Value)
            {
                switch (typeCode)
                {
                    case TypeCode.Int32:
                        obj = 0;
                        break;
                    case TypeCode.Double:
                        obj = 0;
                        break;
                    case TypeCode.String:
                        obj = "";
                        break;
                    case TypeCode.Boolean:
                        obj = false;
                        break;
                    case TypeCode.DateTime:
                        obj = new DateTime();
                        break;
                    default:
                        break;
                }
            }
            return obj;
        }


but the values don't get a chance to be passed to the helper class if I try to use something like:

if (getDefaultIfDBNull(DebtorDataSet.Debtor[0].SolicitorBuilding, TypeCode.String) != getDefaultIfDBNull(row.CorrespondenceHouseName,TypeCode.String))

    {

      row.CorrespondenceHouseName = DebtorDataSet.Debtor[0].SolicitorBuilding.ToString();

    } 


How can I correctly accommodate when underlying data is DBnull, via code, please?
AnswerRe: Stront typing error Pin
kanchoette24-Feb-09 23:41
kanchoette24-Feb-09 23:41 
QuestionQ: How to serialize layer structure Pin
pandd24-Feb-09 21:13
pandd24-Feb-09 21:13 
AnswerRe: Q: How to serialize layer structure Pin
J4amieC24-Feb-09 22:39
J4amieC24-Feb-09 22:39 
GeneralRe: Q: How to serialize layer structure Pin
pandd24-Feb-09 23:52
pandd24-Feb-09 23:52 
QuestionHow to retrieve images from webbrowser control without reload? Pin
WebFormSubmitter24-Feb-09 21:08
WebFormSubmitter24-Feb-09 21:08 
AnswerRe: How to retrieve images from webbrowser control without reload? Pin
Curtis Schlak.25-Feb-09 10:08
Curtis Schlak.25-Feb-09 10:08 
GeneralThanks! But how to extraxt already loaded image from the webbrower? Pin
WebFormSubmitter26-Feb-09 8:57
WebFormSubmitter26-Feb-09 8:57 
GeneralRe: Thanks! But how to extraxt already loaded image from the webbrower? Pin
Curtis Schlak.26-Feb-09 10:34
Curtis Schlak.26-Feb-09 10:34 
Questiona serialization problem Pin
abhiram_nayan24-Feb-09 20:53
abhiram_nayan24-Feb-09 20:53 
AnswerRe: a serialization problem Pin
Expert Coming24-Feb-09 22:36
Expert Coming24-Feb-09 22:36 
GeneralRe: a serialization problem Pin
abhiram_nayan25-Feb-09 0:50
abhiram_nayan25-Feb-09 0:50 
QuestionThread Pin
Ammu S24-Feb-09 20:33
Ammu S24-Feb-09 20:33 
AnswerRe: Thread Pin
Rob Philpott24-Feb-09 21:19
Rob Philpott24-Feb-09 21:19 
AnswerRe: Thread Pin
Krishnraj24-Feb-09 23:11
Krishnraj24-Feb-09 23:11 
GeneralRe: Thread Pin
Megidolaon25-Feb-09 22:13
Megidolaon25-Feb-09 22:13 
QuestionSimple Threading (VS 2005) Example Pin
WinSolution24-Feb-09 20:33
WinSolution24-Feb-09 20:33 
AnswerRe: Simple Threading (VS 2005) Example Pin
J a a n s24-Feb-09 20:41
professionalJ a a n s24-Feb-09 20:41 

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.