|
Hi,
I've got a dll that is registered on a machine using
<br />
regasm /codebase blah.dll
this dll works fine
During an upgrade I copy a new version of the dll over the top (on reboot if locked)
A VB6 App (yes you red that right) then tries to run the dll and on some machines I get an automation error, this doesn't seem to be OS related and I can't find any other common factor between the machines
rerunning
<br />
regasm /codebase blah.dll
fixes the problem
Does anyone know why this might happen, is there some kind of REGASM clean up process that might notice that I deleted the old dll before the new one gets written and unregisters it?
Cheers
Russell
|
|
|
|
|
It may be because you registered the 1st copy of the .DLL with a set of GUIDs that are no longer valid in the second copy of the .DLL. If you are letting Visual Studio generate the GUIDs or are otherwise not specifically generating and assigning them manually, yourself, you can have this kind of problem. All classes and interfaces exposed through COM are done using GUIDs. If these GUIDs changes between revesions of the .DLL, just copying the new .DLL over the top of the old one will break these GUID/class/interface associations.
|
|
|
|
|
Thanks for the reply.
It seems that it's a version numbering issue, the guids are hard coded in the project at the moment, the interfaces are fine. The problems also appear to have happened since we fixed a build script issue that was failing to change the version numbers on build.
So, now i understand why the thing is breaking but now fail to see why it ever works
This should at least be a bit easier to diagnose.
I think I might sleep on it and see what the problem is.
Russell
|
|
|
|
|
I have a split container on the form. On the left panel and right panel I have tree views. I have set the tree view scroll bars to false. When the treeviews increase in size, tthe panels doesn't show any scroll bar even though autoscroll property of the panels are set to true. How can I show the scroll bars of the panel? I need to synchronise both the scroll bars later.
Regards
Surya
|
|
|
|
|
If the Dock property of your TreeView s is set to anything other than DockStyle.None the scrollbars won't show. The TreeViews must extend beyond the bounds of the panels for this to happen.
If this is not the case, then please ignore this post.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks Henry for the reply. But I have set DockStyle.Fill for the treeviews. I want to show the scroll bars of the panels. I mean how to extend treeview beyond the bounds of the panel?
Regards
Surya
|
|
|
|
|
Surya Ayyagari wrote: But I have set DockStyle.Fill for the treeviews
That is the problem. DockStyle.Fill 'does exactly what it says on the tin' it will only ever allow the TreeView to exactly fill its containing control. It cannot grow to be larger and therefore the scrollbars are not needed.
As I said in my previous post, the TreeView must be able to extend beyond the bounds of the panel for the ScrollBar s to show up.
You might try setting Dockstyle.Top which, on reflection, should allow them to grow vertically and thence trigger the ScrollBar
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I want to control my window media with Remote control. Now i am using windows Vista. I don't how to write code and which library shall i use ple
|
|
|
|
|
Hi Guys,
I've got a WebBrowser control embedded in my desktop application. This browser loads an HTML registration form from the local host that i manipulate and query with javascript.
I need a way to test whether javascript is enabled from the client side, so that i can prompt the user to enable it. Is there any way to do this?
Regards
Tris
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
I went to the msdn website:http://msdn.microsoft.com/en-us/library/system.net.networkinformation.aspx
but looking for help writing the code in VB.
|
|
|
|
|
Do NOT post your questions in multiple forums. Pick the one forum that is the most appropriate to the subject and stick with it.
|
|
|
|
|
I have a Class named "A"
this class inherits from Windows.Forms.PictureBox
"A" has public properties
if we name properites of A as below:
A1
A2
A3
we can set values of A1, A2, A3 and All inherited properties from pictureBox
I create an instance of A in runtime and name it MyA
and then I have a PropertyGrid name Pr1
Pr1.selectedObject = MyA
Pr1 is showing all properties of MyA including all inheritec from PictureBox
I want Pr1 to show only A1,A2 and A3 and hide the rest. how can I do that????
|
|
|
|
|
This is against OOP principals. All properties etc of the base object shold be present in the deriving object.
However, Microsoft do this themselves all the time! The PictureBox is a good example. It has no browsable Text property in the property grid or in the code editor via intellisense, but it's still there as it derives from System.Windows.Forms.Control which has the Text property.
The way to achieve this is to do something like this with properties, events and methods that you don't want to be visible.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class MyPictureBox : PictureBox
{
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This property is obselete", true)]
public new Color BackColor
{
get { return base.BackColor; }
set { base.BackColor = value; }
}
} This will make the BackColor property 'disappear' IF MyPictureBox is in a seperate assembly. It will not work if in the same assembly, or added as a project reference to another project - it must be a reference to a seperate dll.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Thanks for your great help.
I just wanna ask if you could help me with this in VB.NET !
it is a long time I am not working in C and I could not match your example to a VB code.
Cheers,
|
|
|
|
|
I don't really do VB - I think this is correct. I don't have VB installed on this machine so it's from memory only and untested!
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports System.System.Windows.Forms
Public Class MyPictureBox
Inherits PictureBox
<Browsable(False)> _
<EditorBrowsable(EditorBrowsableState.Never)> _
<Obsolete("This property is obselete", true)> _
Public Property BackColor() As Color
Get
Return MyBase.BackColor
End Get
Set(ByVal value As Color)
MyBase.BackColor = value
End Set
End Property
End Class
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
This is the VB code I have here, there are many properties inherited from Picturebox to this class. how can i make all of inherited properties nob-browsable!? in my test app I have an instance of this class assigned to a PropertyGrid (as selectedobject) and it is showing all of them!?!?!?
Imports System.Windows.Forms
Imports System.ComponentModel
Public Class A
Inherits Windows.Forms.PictureBox
Private _A1 As Integer
Private _A2 As Integer
Private _A3 As Integer
<CategoryAttribute("Test"), Browsable(True)> Public Property A1() As Integer
Get
Return _A1
End Get
Set(ByVal value As Integer)
_A1 = value
End Set
End Property
<CategoryAttribute("Sample"), Browsable(True)> Public Property A2() As Integer
Get
Return _A2
End Get
Set(ByVal value As Integer)
_A2 = value
End Set
End Property
<CategoryAttribute("Sample"), Browsable(True)> Public Property A3() As Integer
Get
Return _A3
End Get
Set(ByVal value As Integer)
_A3 = value
End Set
End Property
End Class
|
|
|
|
|
You will need to apply the same attributes that I posted above to EVERY property etc that you want to hide. There is no shortcut I'm afraid. The System.Windows.Forms.Control class is where most of the stuff you're seeing that you don't want comes from. That in turn derives from all of these:
Component, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable
If you derive from Component instead, you don't get any of the other stuff, but you then don't have a visible control. To make it visible as a control you'd need to implement IWin32Window [Edit] I think [/Edit]. I've no idea how to do that - I'm sure it is not trivial. If you decide to try, and figure it out, please write an article about it because I'd love to learn!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
modified on Monday, July 27, 2009 10:38 AM
|
|
|
|
|
Dave, your answer to this question was great...
I was just thinking about something to make this more useful..
if Class A inherits from Windows.Forms.PictureBox or whatever component and I need the Picturebox width and image to be used in my instances of A (MyA Object) how can i hide it?! I don't want to overload the inherited property. Also I couldn't use Shadowing!!!
how can i use some of inherited properties but hide them in propertyGrid...!?
Cheers,
|
|
|
|
|
If you remove the Obselete attribute, and in the getter/setter use the base values like I did, then you can continue to use the properties - they will just not be visible to the property grid or intellisense.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I tried it..! I really don't know how to use it
do you have any sample for ObsoleteAttribute? I googles it but no useful samples found
|
|
|
|
|
MSDN[^]
It's pretty simple really.
Browsable(false) hides the property form the grid.
EditorBrowsable(EditorBrowsableState.Never) hides the property from the code editor.
Obsolete("xxx") makes the compiler generate a warning if there is an attempt to use the property.
Obsolete("xxx", true) makes the compiler generate an error (stops compilation) if there is an attempt to use the property.
You can create a new property and use it to get/set a different property (hidden or base class etc). Here is a code example - again in C#, but if you compare the code I provided previously, you should be able to translate.
public class MyPictureBox : PictureBox
{
[Browsable(false),
EditorBrowsable(EditorBrowsableState.Never),
Obsolete("This property is obselete", true)]
public new int Width
{
get { return base.Width; }
set { base.Width = value; }
}
[Browsable(false),
EditorBrowsable(EditorBrowsableState.Never),
Obsolete("This property is obselete")]
public new int Height
{
get { return base.Height; }
set { base.Height = value; }
}
public int MyWidth
{
get { return base.Width; }
set { base.Width = value; }
}
public int MyHeight
{
get { return Height; }
set { Height = value; }
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
There is not any thing like "base" in VB
I reckon I have to start my application in C#, this bloody VB does not have the flexibility of C#. I have to migrate to C# and it is really hard....
|
|
|
|
|
Hamid Amrabadi wrote: There is not any thing like "base" in VB
Well, that might come as a surprise to the inventors of the language since they included the MyBase keyword to cover this.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
As Pete said, MyBase will do it.
Learning C# isn't so hard. Inspite of all the hype, VB.NET and C# are very similar, mostly just syntax differences as you can see by comparing my VB example previously with the C# one. Once you get used to it, you may wonder how you ever managed to cope with VB
If you want to try, just have a go!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Another option you might want to consider is writing a class that implements ICustomTypeDescriptor.
Normally, a property grid fetches a type descriptor that (no surprise here) describes the type. You can create custom descriptors that alter behaviors; change editors on the fly, hide properties, show additional 'pseudo' properties, etc...
ICustomTypeDescriptor is implemented by a few classes, you might want to check the MSDN pages for more info on how to use this, if you're clever it will be much easier than rewriting classes with New properties and different attributes.
|
|
|
|