Click here to Skip to main content
15,910,981 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cursor woes. Pin
Tom Welch19-Dec-02 7:55
Tom Welch19-Dec-02 7:55 
GeneralRe: Cursor woes. Pin
Anonymous19-Dec-02 9:15
Anonymous19-Dec-02 9:15 
GeneralRe: Cursor woes. Pin
Joel Matthias19-Dec-02 9:14
Joel Matthias19-Dec-02 9:14 
GeneralArrayList Comparison/Diff Pin
gercules19-Dec-02 0:08
gercules19-Dec-02 0:08 
GeneralRe: ArrayList Comparison/Diff Pin
Rob Graham19-Dec-02 5:07
Rob Graham19-Dec-02 5:07 
GeneralRe: ArrayList Comparison/Diff Pin
Eric Gunnerson (msft)19-Dec-02 10:36
Eric Gunnerson (msft)19-Dec-02 10:36 
QuestionExtender Bug? Or am I missing something? Pin
FruitBatInShades18-Dec-02 23:53
FruitBatInShades18-Dec-02 23:53 
GeneralPoint out the error Pin
sns18-Dec-02 21:41
sns18-Dec-02 21:41 
hi friends,
i want to add an image to commandbarbutton in C#.
i have added appropriate code but im getting an error saying that "object reference not set to an instance of an object" when im trying to assign an picture to commanbarbutton.Picture property.
here is my sample code:
CommandBars objCommandBars;
CommandBar objCommandBar;
object str = "MyToolBar";
objCommandBars = (CommandBars)applicationObject.GetType().InvokeMember("CommandBars", BindingFlags.GetProperty , null, applicationObject ,null);
objCommandBars["MyToolBar"].Delete();
objCommandBars.Add(str,omissing,omissing,omissing);
objCommandBars["MyToolBar"].Position = MsoBarPosition.msoBarFloating;
cmdOpenI = (CommandBarButton)objCommandBar.Controls.Add(1,omissing,omissing,omissing,omissing);
cmdOpenI.Caption = "Test";
cmdOpenI.Tag = "Test";

String strFile = "F:\\a1.bmp";
Object lpDisp = null;
try
{
OleLoadPictureFile((Object) strFile, out lpDisp); //API relevant to LoadPicture in VB
stdole.StdPicture pic = (stdole.StdPicture)lpDisp;
if (pic != null)
{
cmdOpenI.Style = MsoButtonStyle.msoButtonIconAndCaption;
cmdOpenI.Picture = (stdole.IPictureDisp)pic;// here only im getting an error "object reference not set to an instance of an object"
}
}
catch(Exception exp)
{
System.Windows.Forms.MessageBox.Show(exp.Message);
}
cmdOpenI.Visible = true;
cmdOpenI.Click += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(OpenIntranet_Click);
objCommandBars = null;
objCommandBar = null;
if i set the commandbutton type as 2,3 otherthan button type 1 im not getting an error. but i want the button type to be 1.
can anybody help me to achieve the task.
Thanks in advance
regards,
sns
GeneralRe: Point out the error Pin
Jeff J19-Dec-02 15:11
Jeff J19-Dec-02 15:11 
GeneralRe: Point out the error Pin
sns20-Dec-02 1:57
sns20-Dec-02 1:57 
GeneralRe: Point out the error Pin
sns20-Dec-02 17:29
sns20-Dec-02 17:29 
GeneralRe: Point out the error Pin
Jeff J20-Dec-02 18:08
Jeff J20-Dec-02 18:08 
GeneralRe: Point out the error Pin
sns22-Dec-02 21:19
sns22-Dec-02 21:19 
GeneralRe: Point out the error Pin
WizardOfPeyton23-Dec-02 12:52
WizardOfPeyton23-Dec-02 12:52 
GeneralRe: Point out the error Pin
sns23-Dec-02 18:33
sns23-Dec-02 18:33 
GeneralRe: Point out the error Pin
WizardOfPeyton24-Dec-02 7:28
WizardOfPeyton24-Dec-02 7:28 
GeneralRe: Point out the error Pin
sns25-Dec-02 19:45
sns25-Dec-02 19:45 
GeneralRe: Point out the error Pin
WizardOfPeyton15-Jan-03 5:14
WizardOfPeyton15-Jan-03 5:14 
Generaladding extensions to the standard window's context menu Pin
jtmtv1818-Dec-02 18:36
jtmtv1818-Dec-02 18:36 
GeneralRe: adding extensions to the standard window's context menu Pin
Kannan Kalyanaraman18-Dec-02 21:30
Kannan Kalyanaraman18-Dec-02 21:30 
QuestionAnything I should watch out for doing this? Pin
LongRange.Shooter18-Dec-02 11:05
LongRange.Shooter18-Dec-02 11:05 
GeneralWeb Service Question Pin
Larry Rutledge18-Dec-02 6:54
Larry Rutledge18-Dec-02 6:54 
GeneralRe: Web Service Question Pin
Adrian Hall18-Dec-02 7:09
Adrian Hall18-Dec-02 7:09 
GeneralRe: Web Service Question Pin
Daniel Turini18-Dec-02 8:52
Daniel Turini18-Dec-02 8:52 
GeneralRe: Web Service Question Pin
Wilco B.18-Dec-02 10:43
Wilco B.18-Dec-02 10:43 

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.