Link to home
Start Free TrialLog in
Avatar of abbas1982
abbas1982Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Creating ActiveX control in vb.net

Hi,

I created  a control simple text box in VB as Windows User Control and used it as an object, that is ActiveX Control. First it was display perfectly. Then I added a button and reloaded the page its not showing anything except for the object as an Image Thumbnail.

Can any one tell me step by step to create an ActiveX control in vb.net and show it in browser.  
Avatar of Rejojohny
Rejojohny
Flag of United States of America image

what do you mean by activex control o? do you mean a COM control? but why do you want it in .net? what is the purpose .. COM componenets cannot be developed using vb.net ..

if you want to create a user control that you want to use in a asp.net project, create a "web user control" and not a windows user control ..

Rejo
Avatar of abbas1982

ASKER

Actually I want to develop a control which can upload more then one file. That a batch upload. e.g. A user selects a directory and its conetents are uploaded to the site through ftp.
you can develop a web user control or a asp.net "file control" within a "repeater" control to show user multiple file upload options .. so he selects file in each of the "file control" by browsing to each file and then clicks on one "upload" button and all the files get uploaded ..

am not sure whether you can then upload the contents using FTP .. you cannot get files using FTP from a client machine .. if you have to "get" files using FTP, the server has to connect to a FTP server .. it cannot connect to a directory in some client machine ..

Rejo
So, how face book and other photo album applications on web do it.
they are not using ftp, but going through http for the file upload and you can also do the same the way i described above ..
I dont know they are usinf ftp or what but they are definetly using some sort of activeX

This is the script which loads it
showUploader('http://upload.facebook.com/', '27072', '60', '535691821');

those might be activex controls .. to create one you cannot use .net, you will have to use vb6 or any other software .. do note, that with activex, there are security restrictions and not everyone would be happy to download it ..

Rejo
But will the folder browse will work if a user accepts it. Because I managed to develop to build activex control. I built WindowsUserControl and used FolderBrowse but .NET throwed security exception
you cannot create a windows user control and use it in web application .. you will have to create a web user control ..

have a look here on some sample codes
Multiple File Upload in ASP.Net
http://www.codetoad.com/asp.net_multiplefileupload.asp

http://www.ondotnet.com/pub/a/dotnet/2002/04/01/asp.html

some thrid party tools
http://www.telerik.com/products/aspnet/controls/upload/overview.aspx .. exactly as you want it .. this control is also developed in .net
http://www.programmersheaven.com/zone26/cat1210/index.htm
http://www.powupload.com/

Rejo
So, is there any I can create the same mechanism in VB6 creating OCX file and then use it in browsers.

I have checked that FaceBook is an OCX control and is intalled on the system (if the user grants the permission ) and it is located in "Download Program Files" of IE
ASKER CERTIFIED SOLUTION
Avatar of Rejojohny
Rejojohny
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Mr Rejojohny
So how can I do that ........

Any samples to get me started....
OK i have able to do it, but I m testing something then I ll show it here how it can be done.


But one question... an activex control developed on will will work on MAC OS or not.........

(COMMENT: Every problem has a solution; but a soultion creates one or more problem)
>>an activex control developed on will will work on MAC OS or not.........
no, it will not work and that is what I also menat when I said above - "do note, that with activex, there are security restrictions and not everyone would be happy to download it .." it will also not work in some of the browsers unless you download the plugins ..

I am a strong beleiver that every problem has a solution if you really look for it at the right places :-) ..
One problem I found. I developed the control and it is working fine in my pc after the download and everything.

But wwhen I tested it on other pc, i clicked yes to install, but for some reason the control didnt register. I manually registerd it then it worked.....

Any known symtoms......

I also added the liscence file for winsock control
what is the security setting on the browser of the other pc where it does not work? try with medium of low security .. ot customise the options available to prompt for activex controls and install them .. close all browser windows and retry .
Here I am posting how to accomplish multiple file uploads.

-Create an OCX control in VB6
-Use winsock to upload files (This is URL which explains how to upload a file in VB6 using winsock http://www.vbforums.com/showthread.php?t=337424)
-Package the control with deployment wizard, for internet. This will make a can file.
-Then following is the object Tag to be placed in your html, asp or aspx file

<OBJECT ID="PhotoUploadControl"
CLASSID="CLSID:73933396-34F0-4A02-A87A-695025009ECA"
CODEBASE="http://server/PhotoUpload.CAB#version=1,0,0,0" width="100%" height="100%">
<PARAM NAME="LPKPath" VALUE="http://staging/blink-2/lisc.lpk">
</OBJECT>

-The Package and deplyment wizzard creates a sample HTML file and shows how the control can be used.


-NTOES: The control should be signed by a security certificate like thwate or verisign.

I am awarding points to Rejojohny as he led me to do it.

Ta
I have posted the solution for it but the author motivated me to do it.