Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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 December 23rd, 2004, 10:22 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to make a const do something usefull

hi my names matt i wonder if you can help i would like to know how to make a constant use a textbox i tried the very simple code

const UserID as String = txtUserid.Text

but it just didnt like it
also while im thinking about it is it possible to make a variable or const in a seperate class modual to read/ use a constant or variable from a form if the form is called form1 and the class is called Dimension

thank you very much for your time

Regards

Matthew Allee

I.T Consultant
R Charles Associates

 
Old December 23rd, 2004, 05:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You cannot assign a textbox content to a constant! The constant is just... a constant, that is defined at compile time, like:

const UserNameID = "ThisIsMyName"
const UserID = 124

Yo make constants available in the project scope, declare them Public and put them in a bas module.

Marco
 
Old January 4th, 2005, 08:56 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i thort as much thank you for your reply






Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting BSTR to const char* wambozi C# 1 September 6th, 2006 05:37 AM
Const crmpicco VB How-To 2 May 18th, 2005 09:51 AM
passing a const reference in C#.NET texasraven C# 2 December 21st, 2004 06:48 PM
what's the diference between readonly and const?? gbianchi VB.NET 2002/2003 Basics 2 November 11th, 2004 02:53 PM
Const Question Greg Griffiths Classic ASP Basics 1 June 30th, 2003 01:10 PM





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