Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Visual Basic ActiveX control in a web page with forms

Posted on 2004-09-07
15
Medium Priority
?
286 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Arno Koster
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
LVL 26

Accepted Solution

by:
Rejojohny earned 280 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

715 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