|
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
|
|
|
|
|
I want to import a VB 6.0 interface in my VC++ 6.0 program for my image thinning project. How to do so and how to link the interface objects with the coding? Can anybody provide me the source code or howto?
My VB form consists of a menu toolbar, command button,a picture box and a text box. I want to open a 50x50 TIFF image file using the menu item File->Open File and displays the image in the picture box. How to get the file name from the interface and load the image onto the interface?
Then I need to click the command button to convert the image to binary image(0 for white and 1 for black).(I have the coding for binary conversion but I don't know how to link them with the command button and accessing the image in the picture box.
Later, i need to display the binary image that I saved in a binary file in the text box in the interface. How to read and write a file through the interface? How to display the content of the file being read?
thank you very much
-- modified at 22:16 Monday 5th September, 2005
|
|
|
|
|
The way to do this is to write your C++ project using COM or managed C++ ( depending on what VB version you're using as much as anything ), and then call the C++ code from your VB UI. VB6 apps have been written like that for years - VB is good for hacking to gether a basic UI, and C++ is good at doing actual work.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you for replying. It's a relief to know that VB 6.0 have the capabilities. Actually, I'm a newbie in this programming. Would you kindly guide me throught the whole process?
Currently, I'm coding my C++ program using VC++ 6.0 and my program consists of 2 files: main.cpp and lib.h. Can you please give me some easy examples or sample source code on how to call the C++ code(main.cpp and lib.h)from the VB 6.0 interface? Eg.the Hello World application?
BTW, what is COM or managed C++?;)
TQ
|
|
|
|
|
ladyscarlet99 wrote:
It's a relief to know that VB 6.0 have the capabilities.
OK, this is the first you specified VB6. That limits your options, but does not close them.
ladyscarlet99 wrote:
Currently, I'm coding my C++ program using VC++ 6.0 and my program consists of 2 files: main.cpp and lib.h.
OK, that sounds like a pretty basic console app, it doesn't even use standard headers. What's lib.h ? Why isn't there a main.h ? In any case, it's useless to you, although any code you wrote can be ported easy enough.
ladyscarlet99 wrote:
BTW, what is COM or managed C++?
VB6 is a dead language. As of 2002, Microsoft released VB.NET, which along with C# ( a new language at that time ) target a new runtime called the Common Language Runtime. If you had VS2002, 2003 or 2005, you could write C++ to target this runtime, and it would be really easy to call from VB.NET. This is called Managed C++.
COM is a lot more complex, but basically if you create an ATL project in VC++ ( I assume VC6 ? ), then you'll be creating a dll which can be called from VB6. COM is a huge subject, truthfully, I had three cracks at it before I got it enough to start using it. But in hindsight, it's not as complex as it seemed, but it is very different from a normal C++ app ( although, it IS a C++ app, and you can use any C++ you can use elsewhere, it's just working out how the framework sits together ). This[^] is the book that finally got it all together for me, I recommend it 100%. COM is just too hard to learn without a good book, all the more if you're more skilled in VB than c++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
how can i Synchronise time using domainupdown control?time will change if domainupdown buttons are clicked.
Thanks for guidance.
|
|
|
|
|