|
Dim UIH As UIHierarchy = DTE.Windows.Item onstants.vsWindowKindMacroExplorer).Object
Dim samples As UIHierarchyItem = UIH.GetItem("Macros\Samples")
How to convert these two lines to c#.I am just starting c# on doing some simple project.UIHiearchy is a interface.
Thanks in advance
|
|
|
|
|
<br />
UIHierarchyItem samples = UIH.GetItem("Macros\Samples");<br />
thats the second line but i will will need to know more about the first line before i can convert it.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
suresh_sathya wrote:
Dim UIH As UIHierarchy = DTE.Windows.Item onstants.vsWindowKindMacroExplorer).Object
Thre ar som mising chratrs
Please repost line
maybe
UIHierarchy UIH = (UIHierarchy) DTE.Windows.Item[Constants.vsWindowKindMacroExplorer];
Try it
UPDATE: Dont try it, it wont work. That constant is not defined in any enum from the envdte assembly. Could you please repost complete VB.Net line?
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
leppie wrote:
maybe
UIHierarchy UIH = (UIHierarchy) DTE.Windows.Item[Constants.vsWindowKindMacroExplorer];
I don't use VB.NET but the assembliey attributes are placed between < and >.
Ñ There is only one MP Ð
|
|
|
|
|
Maciej Pirog wrote:
I don't use VB.NET but the assembliey attributes are placed between < and >.
1st - In VB.NET of course
2nd - Maybe it should be:
Dim UIH As UIHierarchy = DTE.Windows.Item(constants.vsWindowKindMacroExplorer).Object
In C#:
UIHierarchy UIH = (UIHierarchy)DTE.Windows.Item(Constants.vsWindowKindMacroExplorer).Object;
or
UIHierarchy UIH = (UIHierarchy)DTE.Windows.Item(Constants.vsWindowKindMacroExplorer).Object();
I havn't wrote any Add-In so far, and I'm not sure:
.Object; or .Object();
Ñ There is only one MP Ð
|
|
|
|
|
I'll help you solve this problem because my fellow CPians who have not had the pain of learning VB.NET can't seem to figure this out. This should work.
UIHierarchy UIH = DTE.Windows.Item(EnvDTE.Constants.vsWindowKindMacroExplorer).Object;
UIHierarchyItem samples = UIH.GetItem("Macros\Samples");
David Stone
But Clinton wasn't a predictable, boring, aging, lying, eloquent, maintainer-of-the-status-quo. He was a predictable, boring-but-trying-to-look-hip, aging-and-fat-but-seemingly-oblivious-to-it, lying-but-in-sadly-blatant-ways, not-eloquent-but-trying-to-make-up-for-it-by-talking-even-more, bringer-in-of-scary-and-potentially-dangerous-new-policies. And there was also Al Gore. It just wasn't *right*.
Shog9
|
|
|
|
|
Btw just in case you are converting a Macro don't bother only VB.Net is supported for scripting.
May the Source be with you
Sonork ID 100.9997 sijinjoseph
|
|
|
|
|
This code is found in InitializeComponent() on my form, busFormManager1 is my class.
this.busFormManager1.ActiveDockControl = null;<br />
this.busFormManager1.ActiveMdiChild = null;<br />
this.busFormManager1.BarManager = null;<br />
this.busFormManager1.DefaultRegion = Medea.GfxLib.Windows.Forms.BusFormManager.ClientRegion.ToolLeft;<br />
this.busFormManager1.DockManager = null;<br />
this.busFormManager1.EnableMaximizedMode = false;<br />
this.busFormManager1.Parent = null;
now in design mode the form will not appear, only a blank white page with exception message Object reference not set to an instance of an object.. At runtime everything works fine, just the desinger kicks my form out.
I guess that my FormManager will execute code at this time, that is not valid or some object required for him are null at this time.
Now i've tried to use the DesignMode Flag, to test in which state the class is. Now it seem's that this flag is always false until InitializeComponent() is executed.
how to code this propertys the right way, that you can still watch the form in Designer ?
if you got a property like this
public Form Parent<br />
{<br />
set<br />
{<br />
this.parent = value;<br />
if (parent != null)<br />
{<br />
parent.Load += new EventHandler(....../<br />
parent.IsMdiParent = true;<br />
}<br />
}<br />
get<br />
{<br />
return this.parent;<br />
}<br />
}
now this property let crash the desinger, cause there's to much code in it to execute at InitializeComponent() .
Any hint ? how did microsoft code all the components in dotnet ? they work always, not like mine ;(
.:Greets from Jerry Maguire:.
|
|
|
|
|
Does your class have a default contructor ie one that does not take any arguements? If not, that should solve it, else I cant help you
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
object is the mother of all classes.
Nnamdi Onyeyiri wrote:
what type is System.Object?
it's an object type
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
When u write:
class MyClass {<br />
}
it's really:
class MyClass : object {<br />
}
Thats understood.
now for example:
MyClass myclass = new MyClass();
now
(myclass.GetType() == typeof(MyClass)) = true
Similarly:
object myobject = new object;
now
(myobject.GetType() == typeof(object)) = true
Hope u understand...I wouldnt have sleepless nites though
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
That will throw an compiler error as it is a duplicate definition.
You can however do this:
class MyClass : SomeOtherNamespace.MyClass {<br />
}
as the context for each MyClass is different
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
OK I think I know what u are getting to, the answer lies in inheritance.
class Base : object //this is not necessary as u know
{
public string Name {get;set}
}
Now Base class will inherit (iow have) all of it's base class's (object or System.Object, same thing) public and protected members.
class MyClass : Base
{
public int Value {get;set;}
public void DoStuff();
}
Now MyClass will get all of Base's public and protected methods, but remember Base has inherited some members from object as well, so it gets those as well.
It can get very confusing, I know. Designing a good class hierarchy takes time, only certain aspects might be affected at each level, but in the end all the inherited properties will be "visible" from top (most specialized class) to bottom (object). Look at the Form class and see how many members are actually inherited.
So in the end there can be only one! The same object class is used everywhere in .NET.
Hope this helps
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
never mind, you didnt understand what i said, my qq has been aswered in a later post by someone else. [look below]
BTW what i said was, from wot u said, i thought it was declared by
class objectBase : object {}
class object : objectBase {}
but never mind.
|
|
|
|
|
its not of any type - its a class with no parent.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hi I have three Webforms in one page (with frames)
when one button on one of them is clicked a page
should be load in the other frame, I gotta do it in
codebehind (I know the old HTML way)
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hi all,
What is the command in .NET Framework, to do Shutdown, Restart and Logout from Windows?
Thanks for the help..
Eka
|
|
|
|
|
I made a invisible control,and add a ico to it (by [[ToolboxBitmapAttribute("iconfile.ico")])
then I set the ico file as embed resource。at MSDN it said you can use projectname.filename.ext to access the resource embeded in a dll.
but I use [ToolboxBitmapAttribute(typeof(projectname.iconfile.ico))]or
[ToolboxBitmapAttribute("projectname.iconfile.ico")] ,it also can not access the icofile.
What shall I do????
lost my way
|
|
|
|
|
I don't believe you can use icon files for the ToolboxBitmap
Add the bitmap to the project, open up the properties panel (if it isn't already open) and change the Build Type for the icon to "Embedded Resource". The bitmap filename also needs to be named the same as the control, without the default namespace prepended.
Now change the ToolboxBitmap attribute to read.
[ToolboxBitmap(typeof(MyControl))] where MyControl is the name of the control.
James
"And we are all men; apart from the females." - Colin Davies
|
|
|
|
|
Thank you very much!It works well now.
And useing ToolBoxBitmapAttribute really can load a ico file,but it is useless by use typeof(MyControl);bitmap is exact.
Thanks again.;)
This is a good place to discuss programing technique.
lost my way
|
|
|
|
|
Any good ideas of what to buy in regard to writing custom control?
I'm looking for a book that explains the ins and outs of Control class,
like when to override createParams, WndProc.
I also saw a few books:
.NET Windows Forms Custom Controls
by Richard L. Weeks, Richard L Weeks
GDI+ Programming: Creating Custom Controls Using C#
by Eric White, Chris Garrett (Contributor)
are they good??
|
|
|
|