|
What's better to create a compact and reusable code: an OCX or a Dll ?
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
That depends on what environment it's going to be used in.
If your using it exclusively in .NET Framework apps, then a straight .DLL would be better.
If your code is going to be used by COM-based clients, like VB6 or Internet Explorer, then an OCX implementation would probably be better.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
That depends on what environment it's going to be used in.
Yes, that's the item. I'm planning in a near future to migrate several OCX made with VB6 and used in VB6 applications to .Net platform. There's no Internet apps involved but, from my point of view, the advantage of making them in OCX is that they are encapsulated and the look and feel is with the component itself and in a Dll, this l&f, could be implmented, but it's not so obvious and visible under design stage.
The apps where this components will be injected will be also migrated to .Net (I already don't know if it'll be VB, VC++ or C#).
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
-- modified at 9:10 Wednesday 7th September, 2005
|
|
|
|
|
When using an .OCX (COM component) in the .NET Managed world, you're not actually getting a completely self contained component. To use the COM component, you have to have Interop .DLL's as a bridge between the managed and unmanaged worlds. These will show up in your .EXE's Release or Debug folders as AxInterop.*.dll and Interop.*.dll. Theses .DLL's MUST ship with the .EXE, so you're not really getting a completely self contained component.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So, if I want to make a full self contained component what is the alternative?
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Again, that depends on the environment you're targeting. If it's going to be used soley in a .NET environment, then a standard control project (targets to a .DLL) will work.
If you're targeting other environments, like VB6, then an OCX would work better. If you target a COM based environment, you just can't get around the registering issues without sacrificing some of the environments your component can support.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Great thanks !! I'll keep all this information in mind when choosing the platform.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
The main question you need to answer is "Does the component need to be hosted in a container (i.e a form, webpage) that the component needs to be aware of?" If the answer is yes, the component needs to be an OCX. If the answer is no, you should use a DLL because the performance is better than an OCX.
The Common Dialogs in VB6 are a good example of components that really do not need to be hosted as an OCX. Although VB6 gave you an OCX for Common Dialogs, many developers also rolled their own DLLs to provide the same functionality. The reason was the OCX was an unneccessary performance hit - Common Dialogs did not need any of the typical container notifications - resize, repaint etc. a modal dialog could be shown just as easily from a DLL as an OCX, so the OCX was an unneccessary additional layer.
On the other hand, a control that needs to paint, refresh otherwise process it's own graphical interface in response to things like form resizing should probably be packaged as an OCX.
As far as NET goes, you will require a Primary Interop component for ANY COM component, not just an OCX. So that is not a relevant factor to making a decsion of which to use.
If the component does not have a graphical interface at all, or has a graphical interace that consists of only showing modal dialogs, you in alll liklihood should be using a DLL.
|
|
|
|
|
The component will need a graphical interface (picture, labels, leds) amd not a dialog, it'll have to be embeded in a dialog so I think it has to be an OCX but I'd like to avoid the installation, registering problems of these components. Is there any other alternative?
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I have a ActiveX control developed in vb6 and a DLL also developed in vb6. By means of vb.net I create an instance of the DLL and by means of the InvokeMember method I want to call to a method that this in the ActiveX control happening to him through parameter the instance of the DLL but gives TargetInvocationException error me.
--------DLL classVB.class1---------
Private texto As String
Public Sub setTexto(t As String)
texto = t
End Sub
Public Function getTexto()
getTexto = texto
End Function
--------Vb6 ActiveX control-----------
Public Sub setCerebrino(ByRef cVari As classVB.class1)
c = cVari
MsgBox "setCerebrino"
End Sub
------ VB.NET method-----------------
Private Sub InitializeComponent(ByVal strProgId As String, ByRef objParamAs classVB.class1)
Dim resources As ResourceManager = New ResourceManager(GetType(AxForm))
Dim type As Type = type.GetTypeFromProgID(strProgId, True)
m_axCtrl = New AxControl(type.GUID.ToString())
CType((m_axCtrl), System.ComponentModel.ISupportInitialize).BeginInit()
SuspendLayout()
m_axCtrl.Enabled = True
m_axCtrl.Name = "axCtrl"
m_axCtrl.TabIndex = 0
Controls.Add(m_axCtrl)
Name = "AxForm"
CType((m_axCtrl), System.ComponentModel.ISupportInitialize).EndInit()
ResumeLayout(False)
OnResize()
Dim obj As Object
obj = m_axCtrl.GetOcx()
Dim m As ParameterModifier = New ParameterModifier(1)
m(0) = True
Dim mods() As ParameterModifier = New ParameterModifier(1) {}
mods(0) = m
type.InvokeMember("setCerebrino", BindingFlags.InvokeMethod, Nothing, obj, New Object() {objParam}, mods, Nothing, Nothing)
End Sub
Thanks in advance.
Hugo
|
|
|
|
|
I have 3 variables A,B,C. If the value of A is X then the values of B and C should be Null. If the value of B is X then the values of A and C should be Null and If the value of C is X then the values of A and B should be Null. Either the value of A,B or C can be X at a time.IF not it should give an error. How to implement a logic for this without an If statement? I need a simple logic for this. I dont want multiple IF statements like
if (A==x) then
{ B==0 && C==0 }
else if (B==x) then
{ A==0 && C==0}
else if (C==x) then
{ A==0 && B==0}
else
printf("error");
|
|
|
|
|
Condition = (((A == X) && (B == null) && (C == null)) ||
((A == null) && (B == X) && (C == null)) ||
((A == null) && (B == null) && (C == X)) );
a simple karnaugh table would have helped...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Azazazazaaaaa wrote:
the values of B and C should be Null
Please keep in mind that 0 and Null, Nothing in VB, are two entirely different things. Value types, such as Integer or Double, cannot be Null (Nothing), only 0. Null (Nothing) is used when a reference type doesn't point to an instance of that type or, in other words, points to nothing.
For example,
Dim myCustClass As New CustomerClass
myCustClass points to a created instance, or object, of CustomerClass.
In this example,
Dim myCustClass As CustomerClass
myCustClass doesn't point to an instance of CustomerClass. It points to Nothing since it didn't instantiate a new CustomerClass object.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm making the tipic "about" form. This form is a child of a mdiForm.
How can I block the mdiForm when the user press the "about" button until the about form is closed? I suppose that there is a property to do this, but I can't find it.
|
|
|
|
|
you must make it modal...
use something like myForm.ShowModal() instead of myForm.Show() (i don't remember the right name)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
It's ShowDialog()
Thank you!!
|
|
|
|
|
I have run time generated data table and table style including numerictextboxColumns. I set datatable to datasource of Datagrid1. Before setting datagrids table style, user can move on cells with tab key , after setting table style, when user try to move on datagrid with TAB key, cursor jump 2 cells not one :S
What s problem.
|
|
|
|
|
Hello, I am a student of Microsoft Technologies.I want to build two device orienter utility in my project(in VB6).
0ne is -- automatic weight measurement tool
another is-- optical Barcode reader
can you please guide me from where I can get help about creating this type of control(in VB6/VB.NET).
-- modified at 5:26 Tuesday 6th September, 2005
|
|
|
|
|
OMG. Flashback.
I wrote something like that about ten years ago. Sorry. I don't have it in VB. I did it in Pascal, on a DOS machine, and I wrote my own communications protocol to handle it.
I assume that the scale and the barcode reader are separate devices, and that you will have items on a conveyer belt passing over the scale and being scanned. Timing will be a BIG issue. If you get a weight and a barcode together, everything is fine. But what if the scale fails to give a weight, or (more likely), the scanner fails to read the barcode. You will need to have some limit on how long you will wait for the barcode. Then the spead of the belt becomes vital. This should all be done asyncronously.
One problem we had was that if the conveyer was going too fast, it would twist the item as it went on the scale, and then the scanner did not read the barcode.
Sorry I can't give you any specifics. Good luck.
Roy.
|
|
|
|
|
I need scanning code in Visual Basic 6.0 by using Twain.Please anybody provide me some code for scanning and saving the file in TIFF format without showing the scanning setup dailog.
Srikanth V
|
|
|
|
|
G'day all, just a question about accessing a webpage from VB requiring two fields. I know how to downlaod a webpage, but not one that requires a password to access it. All I know is that this page requires two hidden fields and uses the "POST" method. Does anyone have any ideas on how I can implement this information to be able to download this page? Any assitance would be much appreciated.
Justin
|
|
|
|
|
i have to click a specific browse button and open a file in a textarea which is already there in my form. here i have to append to that file and save it. now the next time i open that file again the user must see the previous data and the date as well and then append to it. the functionality also demands that the user can also browse through a specific location and set and append that file accordingly.
please help me out as soon as possible.my mail id is kankan_paul@infosys.com
kankan paul
software engineer
infosys technologies limited
mob:9937341123
kankan paul
software engineer
infosys technologies limited
mob:9937341123
|
|
|
|
|
I'm not sure I got clearly your point here. What is really your question? How to open a file in append mode? How to append text to a text area? Is the file a pure text?
In the first case there are several ways of accomplishing it (using the old vb6 OPEN commands, through the .NET FW file streams), the official documentations provides lots of examples and almost ready to use code.
In the second case I suppose your text area is a text box. Then if you want to append the file content upfront:
yourtextbox.text=string.concat(ts.readtoend,today.tolongdatestring,yourtextbox.text)
where ts is the textstreamer of your file (a possible way of opening it).
Hope it helps.
|
|
|
|
|
since you cannot keeo the exact track that where user made changes so delete the previous file and create new with same name and extension and write the text from textbox. other wise to append the file this is the code.
Dim fl As IO.StreamWriter
Dim txt As IO.File
If txt.Exists("File.txt") = True Then
fl = txt.AppendText("File.txt")
fl.WriteLine("Write some thing")
fl.Close()
End If
|
|
|
|
|
You can also use the following code to append
Dim fw As New StreamWriter("File.txt", True)
fw.Writeline("something")
fw.Close()
This way, you don't have to worry if the file exists or not.
What this code does is initialize a new instance of the streamwriter class for the specified filename and if the file exists, it can be overwritten or appended. However, if the file does not exist, this will create a new file.
-- modified at 12:46 Friday 9th September, 2005
|
|
|
|