Solved

Variable problems in dHTML

Posted on 2000-04-07
10
177 Views
Last Modified: 2010-05-18
I am attempting to create my first web page using dHTML in VB.  I want to assign a string variable the contents of a text field on the screen when a button is pushed.  After Dimming the variable I am using

stName=Me.txtName.Value

I get an error with .txtName part of the line hightlighted stating that object or data method not found.  I've checked all names on the form and they are correct.  

It does work if I leave out the Me, but only on the same computer that the page was created on.  The code did absolutly nothing when the page was accessed on a remote computer.  I'm not real sure what the Me does.

any help would be appreciated.

Thanks
jw
0
Comment
Question by:wilch101
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
Me is the shortcut method to replace actually writing out the form name.  when you are writing code for a particular form within that form then you can replace any instance of it with Me but any references outside of the code for that particular form must refer to it as the form name.  try using just the regular form name
0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
oh and you should use txtName.Text
0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
never mind this is dhtml isnt it
0
 
LVL 6

Expert Comment

by:Marine
Comment Utility
Try using Document.txtname
0
 
LVL 2

Expert Comment

by:jrmcg
Comment Utility
You can also try this:
Make sure that your text box has the
Name txtName as well as the id txtName
then use the following...

Document.All("txtName").Value
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 2

Expert Comment

by:jrmcg
Comment Utility
Also - you said that it doesn't work on a computer remotely -

How are you distributing the application?

The way you tried it originally should work if it is deployed correctly...

stName = txtName.Value

(without the Me)

Keep in mind that with the VBDHTML project you must build the CAB file and deploy the page.  The CAB is created and accessed like an object and is downloaded when the page is accessed from another computer.
If you are already doing this - another thing you can try is compiling the project with No Compatibility.  This will insure that the correct CAB is downloaded every time the page is accessed.  If you do not want to use No Compatibility then in the internet settings under temp files/ Object Settings - (IE4 + ) you must delete the objects that are stored there to make sure that you get the correct dll/CAB downloaded to the client.  If you need help with this let me know...

J.R.
0
 
LVL 1

Author Comment

by:wilch101
Comment Utility
I was unaware of the CAB file.  If you could help me on how to create that file that would be greate.  Also do I need to do something special with the HTML file to attach to the CAB? or does it know which CAB has the dll for the page.

Thanks

jw
0
 
LVL 2

Accepted Solution

by:
jrmcg earned 95 total points
Comment Utility
Sure - what version of vb are you using?

Do you have the Package & Deployment Wizard in your Visual Studio directory?


If so it will be easy...

When you package the project it will create a Package directory that will hold the HTML file and the CAB.  The HTML file in this directory will already have the proper CAB object installed.  You will not have to do anything else.

If you have the package wizard do this:

Start the wizard
select your project
select the Package option
it will probably ask you if you want to recompile if it does go ahead and recompile - if not that's ok too.
Select the type Internet Package
Next
Select the folder (should default to 'Package' in your project directory)
The next screen shows dependencies.  Select all of the files it has listed.
The next screen shows where you want to download certain files from.  The microsoft controls will (by default) attempt to download from Microsoft over the internet.
Select each file and choose Include in this CAB or however you want to do it.  The initial download on the client will take longer depending on your choices.  I always do mine in the CAB - this will increase the size of your CAB file if storage is an issue for you.
The next screen shows you all of your pages you have created all choices in the drop down boxes need to say 'Yes'.
On the next screen just hit 'Finish'
Your CAB will be created and your deployable HTML file will be updated (this does not change the working copy you are using during development)
For deployment - you can use the wizard or - just copy all HTML files and the CAB file to the web server directory that the pages are accessed on.

That's it.  You should now be able to access the page from any machine.

The CAB file will not be signed so the client machine will have to have security set up to either enable or prompt for unsigned Active X components.  If not they will get a message saying can't run the AX component.

To keep this from happening you would have to purchase the software that will sign your CAB files - you can get these from microsoft and other companies.

If you have any problems let me know

J.R.
0
 
LVL 1

Author Comment

by:wilch101
Comment Utility
Thank you for your help.  You saved me hours of reading.
0
 
LVL 2

Expert Comment

by:jrmcg
Comment Utility
No problem - if you have any trouble doing what I described just let me know...

J.R.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to the message 13 63
Problem to skip loop 6 49
VBA error replacing data 6 34
Copy a row 12 52
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

743 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