Solved

Visual Basic ActiveX control in a web page with forms

Posted on 2004-09-07
15
280 Views
Last Modified: 2013-11-25
Hi,

I am having trouble developing an ActiveX control.

My control contains the main control "panel" that is displayed in a webpage. This panel contains a listbox and several buttons.

My problem is that when I select a file in the controls in form1, I cannot update a widget in the control:

For a control called usercontrol containing a list called lstSelectedFiles, and a form window called form1 containing a text box txtTextBox, I cannot write a code to do somthing like:

usercontrol.lstSelectedFiles.additem form1.txtTextBox.text

How can I add files to the widgets that are contained within the usercontrol control?

Cordially,
Daniel
0
Comment
Question by:bpfh
  • 6
  • 5
15 Comments
 

Author Comment

by:bpfh
ID: 11994921
Source example source code available on request! I am working with VB 6.

Cheers,
Daniel
0
 
LVL 19

Expert Comment

by:akoster
ID: 11995055
have you tried adding static items ?

eg using these lines

usercontrol.lstSelectedFiles.additem "This is a test"
usercontrol.lstSelectedFiles.additem form1.txtTextBox.text

you can test whether the list does get updated.
When you have updated the list with static items you are one step further...
0
 

Author Comment

by:bpfh
ID: 11995187
This does only work one way:

From UserControl1:
'This works
Form1.lstStringForm1.additem "String added to Form1 from UserControl1"
'This works
lstStringUsercontrol1.additem "String added to UserControl1 from UserControl1"
'This fails with "An object is required"
UserControl1.lstStringUsercontrol1.additem "String added to UserControl1 from UserControl1"

From Form1
'This works
form1.listStringForm1.additem "String added to Form1 from Form1"
'This works
lstStringForm1.additem "String added to Form1 from Form1"
'This fails with "An object is required
UserControl1.lstStringUsercontrol1.additem "String added to UserControl1 from Form1"
'This fails with "An object is required
lstStringUsercontrol1.additem "String added to UserControl1 from Form1"


It seems that a form is a recognised object, but a User control is not...
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 11995779
i do not think u can access the objects within ur usercontrol the way u have asked for .. u have to expose the controls within the usercontrol as properties for the code written in ur web page to access .. something like

public property get MyListbox() as Listbox
  MyListbox = me.ListBox1
End Property ...

what is form1 .. is it a form within ur usercontrol?? i am a bit confused here ...

0
 

Author Comment

by:bpfh
ID: 11995893
Form1 is a form in a control...

The aim is to have a control embedded in a web page from which I can call up 2 dialogues: 1 to select individual files, and the other to select complete directories. When the selection is complete, the user clicks on the OK for the form, and then the user control that is embedded in the page can then start processing the selected data. I can send you a test project of what I am trying to do if you want.

I wil test in a few seconds the public property code, and keep everyone informed.

Cheers,
Daniel
0
 

Author Comment

by:bpfh
ID: 11995967
It seems that I cannot have public object models linked to private object modules.... VB swears at me when I start the debug mode...
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 26

Accepted Solution

by:
Rejojohny earned 70 total points
ID: 11995970
ok .. if form1 is within ur usercontrol, then what is happening is as expected .. i would suggest another solution .. based on ur requirement, expose relevant properties and methods for ur usercontrol .. then access those  properties/methods from ur web page .. like lets say u want to start the processing .. u could have a function called "StartProcessing" and then u could call this method from ur web page  .. the suggestion i made above too might not work as a listbox in a windows form is different from a listbox on a webpage (select tag) .. so even if u return the listbox as an object to ur webpage .. the vbscript might not be able to recognise it .. u will have to try it out ...
0
 

Author Comment

by:bpfh
ID: 11996131
I have given up... and made a workaround: On the ActiveX control pane, I have created 3 frames, and depending on the action wanted by the client (file selection, directory selection, file process), I hide 2 frames, and display the frame containing the object that correspond to the operation to be carried out.

This way, the data from all objects are available for use within other objects, and the end user is not flooded with popup windows!

Cheers,

Daniel
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 11997031
the author asked a question and i think i answered to it .. also suggested some other approach .. he seems to have given up .. does that mean that we did not help and that the question can be closed without awarding any points??
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 11997204
its bad that bpfh did not think of awrading the points before i had to "fight" for it .. do tell .. thx but no thx .. no points needed ...
0
 

Author Comment

by:bpfh
ID: 11997441
Rejojohny,


No hard feelings, but for the moment, I do not feel that your solutions answered the problem!

The Public property seemed a good idea, but VB does not want to compile that, as that is not a legal programming method for the project type. Another idea that I had was to declare a global variable, but that does not function either, for similar reasons.

As for adding VBScript to a webpage, this could have worked, though I cannot test this, as I do not have VBScript progrmming knowledge, and I need all the code to be contained within the ActiveX object: less to check when somthing goes wrong!

My workaround allows my project to go out time, but if you come up with a working solution that works with forms on a control, the 175 points are yours!

You can write to me at <email address removed by CetusMOD per http:help.jsp#hi99>, and I can send you by return a zipped copy of my demo project that illustrates the problem.

Cheers,
Daniel

0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12013439
ok cool ... seems like i was not able to help u out afterall ... so no points required ... just wanted to get a bigger picture of exactly what ur problem was and y my comments were of no help to u ... am sorry if I sounded too angry :-) ... hope to be of some help in the future ...

have a nice day!!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now