Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 12th, 2003, 09:41 AM
Registered User
 
Join Date: Nov 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass value in PARAM tag to ActiveX control - Help!

I've been searching for two days on this. I've asked forums, I've searched Google, I've picked up bits and pieces from forum posts, but am still stuck.

I have created an ActiveX control for a web page.

Now I need to pass a parameter to the ActiveX control from the web page. I have added a PARAM tag to the control's OBJECT tag...

i.e

<PARAM Name = "UserID" Value = "177">

Now could somebody please show me how in my ActiveX control code, I can access this value in the PARAM tag.

Thanks
Greg

 
Old November 12th, 2003, 10:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

The idea is that the PARAM statement initialises the value of a corresponding public property in your ActiveX control. So if you already have a UserId property then that is where the value of 177 will be. If you don't have a UserId property then you need to add one.

hth
Phil
 
Old November 12th, 2003, 10:33 AM
Registered User
 
Join Date: Nov 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I understand that. I have been trying to get that working from other code samples I have browsed through. But still, the value does not get passed.

Here is code from my ActiveX control below... Its supposed to change the ActiveX control's txtUserID to the value found in the UserID PARAM tag on my HTML page, but nothing happens. The value doesn't change. Please check the code and let me know if anything is wrong. I really need to get this working ASAP!!!!

Public Property Let UserID(ByVal New_UserID As String)
    txtUserID.Text = RTrim(New_UserID)
    PropertyChanged "UserID"
End Property

Public Property Get UserID() As String
    UserID = txtUserID.Text
End Property

Private Sub ParamControl_ReadProperties(PropBag As PropertyBag)
    txtUserID.Text = PropBag.ReadProperty("UserID", "")
End Sub

Private Sub ParamControl_WriteProperties(PropBag As PropertyBag)
    Call PropBag.WriteProperty("UserID", txtUserID.Text, "")
End Sub

 
Old November 13th, 2003, 05:29 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Greg,

I'm confused about ParamControl_ReadProperties, shouldn't that be UserControl_ReadProperties? Apart from that I can't see anything amiss.

What happens when your control loads? Presumably the User ID field is just blank?

Have you tried updating the value from script just to see if it works? For example, in your HTML page which hosts the control, try adding this script and see what happens:
<body onload='idOfYourObject.UserID="177";'>

rgds
Phil
 
Old October 5th, 2004, 10:03 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm having the same problem as described above.

If I use the "onload" approach, it works great but I cannot get it to accept values using the <PARAM> tag.

Does anyone have any ideas about why that might be?

Thanks in advance for your help.

Michael

 
Old February 8th, 2005, 05:17 PM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

BUMP Yes I have this problem too, I don't see an answer here... Has anyone figured it out? I can pass properties by using the VBScript shown here, but trying it with the PARAM tag and IE6 doesn't work! Help!

 
Old February 17th, 2005, 03:18 PM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Set the Param value in the Object Tag, something like this

<OBJECT ID="ctlTest"
    CLASSID="CLSID:F70F2603-E21C-4AAE-A86D-33DBF6C3FEC4"
    CODEBASE="TestCAB.CAB#version=0,0,0,46">
<PARAM NAME="Server" VALUE="TestServer">
</OBJECT>

In VB Code:
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    gsConnectionString = PropBag.ReadProperty("Server")
End Sub

Now you should have the value in VB code passed from VBScript

 
Old August 25th, 2005, 06:48 AM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm having an issue with an ActiveX component. It works on Win2K / WinXP with no issue, on Win98 however, it will not install correctly. The component shows up in C:\windows\downloaded program files\ as the CLSID instead of the name of the component. On Win2K / WinXP it shows up as the component name. Here is my INF file, can anybody help??

[version]
signature="$CHICAGO$"

[Add.Code]
PROJECT1.OCX=PROJECT1.OCX
ChilkatFTP.dll=ChilkatFTP.dll
msvcrt.dll=msvcrt.dll
mfc42.dll=mfc42.dll
olepro32.dll=olepro32.dll

[PROJECT1.OCX]
file-win32-x86=thiscab
RegisterServer=yes
clsid={2125C7D6-8F79-4676-81D3-D7EF34CD6A2E}
DestDir=11
FileVersion=1,0,0,8

[ChilkatFTP.dll]
file-win32-x86=thiscab
DestDir=11

[msvcrt.dll]
FileVersion=4,20,0,6164
hook=mfc42installer

[mfc42.dll]
FileVersion=4,2,0,6256
hook=mfc42installer

[olepro32.dll]
FileVersion=4,2,0,6068
hook=mfc42installer

[mfc42installer]
file-win32-x86=http://activex.microsoft.com/controls/vc/mfc42.cab
run=%EXTRACT_DIR%\mfc42.exe

 
Old March 31st, 2006, 12:08 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi sandeepkothari
I make ActiveX same you help and put PARAM in HTML, when browse accept PARAM values OK bet AxtiveX can't show on IE. IE message An ActiveX control on this page might be unsafe to tinteract with other parts of the page. Dow you want to allo this interaction?
If choose No. Not accept PARAM values
Help me!

Quote:
quote:Originally posted by sandeepkothari
 Set the Param value in the Object Tag, something like this

<OBJECT ID="ctlTest"
    CLASSID="CLSID:F70F2603-E21C-4AAE-A86D-33DBF6C3FEC4"
    CODEBASE="TestCAB.CAB#version=0,0,0,46">
<PARAM NAME="Server" VALUE="TestServer">
</OBJECT>

In VB Code:
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    gsConnectionString = PropBag.ReadProperty("Server")
End Sub

Now you should have the value in VB code passed from VBScript

 
Old May 24th, 2006, 05:44 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kamleshvgujarathi
Default

Hello,

I am also facing the same problem and trying to pass the PARAM but could not

See the following code.

<HTML>
<HEAD>
<TITLE>Project1.CAB</TITLE>
</HEAD>
<BODY>

<OBJECT CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
    <PARAM NAME="LPKPath" VALUE="LPKfilename.LPK">
</OBJECT>
-->

<OBJECT ID="UserControl1"
CLASSID="CLSID:6F3F3DE8-7F00-4388-BFE1-214E37820EB4"
CODEBASE="Project1.CAB#version=1,0,0,0">
<PARAM NAME="FULLNAME" VALUE="MIE">
</OBJECT>
</BODY>
</HTML>

Please help me.

Thanks

Kamlesh Gujarathi
Kamlesh@itshastra.com

Thanks

Kamlesh Gujarathi
kamlesh@itshastra.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows command : How to pass param ?? elayaraja.s XSLT 4 July 28th, 2008 05:17 AM
ActiveX : getting PARAM value in activeX src smaraux Visual Studio 2005 1 March 4th, 2008 12:31 PM
Want to pass value at href in anchor tag on xslt Abhinavnaresh XSLT 4 February 21st, 2008 04:32 AM
pass multi value param from ASP toCrystal Runtime ushasku BOOK: Beginning ASP 3.0 1 January 5th, 2007 03:41 PM
pass multi value param from ASP toCrystal Runtime ushasku Classic ASP Basics 0 August 5th, 2005 06:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.