Click here to Skip to main content
15,889,595 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do I populate child elements in XML? Pin
Magela27-Feb-13 4:38
Magela27-Feb-13 4:38 
QuestionOffice Development problems Pin
Daytona67526-Feb-13 11:32
Daytona67526-Feb-13 11:32 
Hello All,

I am converting one of our legacy programs from VB to VS2012 C#.
The problem I am having is that I need to access the inlineshapes of a word document, and I keep throwing an exception: 'Object reference not set to an instance of an object'

Here is my code.

 public bool LoadMonthly(ref Document oDoc, int intIndex, DataSet ds, decimal decAvail)
        {
            bool bStatus = constSUCCESS;
                 
                       
            try
            {
                Microsoft.Office.Interop.Word.InlineShape chartShape = oDoc.InlineShapes[intIndex];                             
                                     
                Microsoft.Office.Interop.Graph.Chart oChart;

                if (chartShape.OLEFormat.ProgID == "MSGraph.Chart.8")
                {
                    System.Windows.Forms.MessageBox.Show("yep");
                }
}

}
                //Edit the sh


Sorry if I missed a paren.

The Document is an active document, I have been updating the tables up until this point.

intIndex is the index for the inlineshape object

The other parameters are of no issue at this point as I cannot get past :

C#
if (chartShape.OLEFormat.ProgID == "MSGraph.Chart.8")
                {
                    System.Windows.Forms.MessageBox.Show("yep");
                }



or any other chartShape operation (OleFormat.Edit(), etc....).

Can someone tell me what I am missing here?


This is just a code segment, so please no comments on I'm missing catch blocks or whatever.

Thanks,
jeff

modified 26-Feb-13 17:50pm.

AnswerRe: Office Development problems Pin
Matt T Heffron26-Feb-13 11:58
professionalMatt T Heffron26-Feb-13 11:58 
AnswerRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 5:04
Jegan Thiyagesan27-Feb-13 5:04 
GeneralRe: Office Development problems Pin
Matt T Heffron27-Feb-13 9:32
professionalMatt T Heffron27-Feb-13 9:32 
GeneralRe: Office Development problems Pin
Jegan Thiyagesan27-Feb-13 11:57
Jegan Thiyagesan27-Feb-13 11:57 
QuestionTab Delimited file to sql database Pin
gavindon26-Feb-13 10:03
gavindon26-Feb-13 10:03 
AnswerRe: Tab Delimited file to sql database Pin
Matt T Heffron26-Feb-13 10:27
professionalMatt T Heffron26-Feb-13 10:27 
GeneralRe: Tab Delimited file to sql database Pin
gavindon26-Feb-13 11:25
gavindon26-Feb-13 11:25 
QuestionListbox colours. Pin
Septimus Hedgehog26-Feb-13 7:35
Septimus Hedgehog26-Feb-13 7:35 
AnswerRe: Listbox colours. Pin
Alan N26-Feb-13 8:40
Alan N26-Feb-13 8:40 
AnswerRe: Listbox colours. Pin
Dave Kreskowiak26-Feb-13 9:05
mveDave Kreskowiak26-Feb-13 9:05 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog26-Feb-13 22:59
Septimus Hedgehog26-Feb-13 22:59 
GeneralRe: Listbox colours. Pin
Dave Kreskowiak27-Feb-13 1:01
mveDave Kreskowiak27-Feb-13 1:01 
GeneralRe: Listbox colours. Pin
Septimus Hedgehog27-Feb-13 5:39
Septimus Hedgehog27-Feb-13 5:39 
Questioncan floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 6:01
notahack26-Feb-13 6:01 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 6:15
mveRichard Deeming26-Feb-13 6:15 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
Richard MacCutchan26-Feb-13 6:26
mveRichard MacCutchan26-Feb-13 6:26 
AnswerRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 6:35
notahack26-Feb-13 6:35 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 7:39
mveRichard Deeming26-Feb-13 7:39 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 7:44
notahack26-Feb-13 7:44 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Richard Deeming26-Feb-13 8:03
mveRichard Deeming26-Feb-13 8:03 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
notahack26-Feb-13 8:13
notahack26-Feb-13 8:13 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Dave Kreskowiak26-Feb-13 9:03
mveDave Kreskowiak26-Feb-13 9:03 
GeneralRe: can floats be multiplied and come up with a fraction? Pin
Dave Kreskowiak26-Feb-13 8:58
mveDave Kreskowiak26-Feb-13 8:58 

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.