Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Please provide me a very simple VS Package C# project for customizing Visual Studio's status bar. I just want to display a message in the status bar, nothing else. The samples which are in internet and also msdn are not working and little complex since I'm a beginner. Thanks in advance.

While I'm trying the below code, it shows error in GetService as "doesn't exists in the corrent context".

C#
IVsStatusbar statusBar = (IVsStatusbar)GetService(typeof(SVsStatusbar));
int frozen;
statusBar.IsFrozen(out frozen);
if (frozen == 0)
{
    statusBar.SetText("Here's some static text.");
}


By using the statement IVsStatusbar statusbar=(IVsStatusbar)GetService(typeof(SVsStatusbar)), I can achieve the requirement in package class. But if I'm using the same in another class which is not a package class, its not working. Unable to use GetService method. Its showing as "GetService doesn't exists in the current context". How can I get the service from an another class or can I get the service from the Package class and pass it to an another class? I'm using VS2010 to code.
Posted
Updated 11-Jun-15 18:49pm
v2
Comments
CHill60 11-Jun-15 8:33am    
What makes you think that we could provide anything less complex? I do find it a little difficult to believe that none of the examples out there actually work.
What code did you use to display the message?
Mathivanan KP 12-Jun-15 0:49am    
I have updated the code.

1 solution

This site is for asking specific questions on code that you have written when you get stuck. If you have tried code from the internet and it does not work then post what you have done and ask a question. But we won't just hand you everything you need.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900