Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old August 25th, 2004, 12:29 PM
jwman jwman is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 jwman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Get an imput on one form to write code in another

Hi, I'm a complete newbie to VB code but seem to be getting the jist of it.
Well the problem is really I don't know if some things are actually possible what i
want to do is:

When someone imputs text into text boxes in a form (The Registration Form) it automatically
adds the following code (into the Login Form):

elseif "USERNAME BOX ON REGISTRATION FORM" = "TEXT IN TXTUSERNAME IN REGISTRATION FORM"
and "PASSWORD BOX ON REG FORM" = "TEXT IN TXTPASS IN REG FORM" then

Login.Hide
Main_Menu.Show

SORRY if this is too confusing because I have a habit of just writing knowing that I understand
it but not realising others might not understand.

But all i want to achieve is for text in one form to be put into a template on another form but I don't know if it's
possible.

Thanx

Reply With Quote
  #2  
Old August 26th, 2004, 04:10 AM
Mythomep Mythomep is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Location: Zaandam, The Netherlands
Posts: 70 Mythomep User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 37 sec
Reputation Power: 4
Send a message via MSN to Mythomep
Cool

Hi,

What you scetch is not possible in VB. Self-modifing code is something that is pretty damn hard in any language (although it is possible, just write up a routine that outputs itself to another file with modifications and let it compile, then spawn the new executable. This is the very basic setup). What I figure what you want is a simple mechanism to present a login form and only allow certain people to use the application. From this point you must make some decisions:
  • Do you want to be able to dynamically add authorized users?
    - Hard coded versus database table?
    - Different users have different autorisation levels?
    - etc.
  • What kind of security mechanism do you want?
    - Single Logon (c)?
    - Biometric?
    - Cards?
    - etc.
Security in an application is always a pesky business. Based on your level, beginner in VB, you might be tempted to go for the hard coded solution. This means that you can not add new users to the sytem without altering and compiling the executable. If that is the case, you simple need to make something like this:

Code:
  Select case frmLogin.txtUsername.text
  Case "JohnD"
	If (frmLogin.txtPassword.text = "Whoisjohndoe") then
	  ' Access Granted
	Else
	  ' Access denied, shout for help, sound the alarm or nuke his system.
	End If
  Case "JaneD"
	If (frmLogin.txtPassword.text = "MysteryWoman") Then
	  ' Access Granted sweetie..
	Else
	  ' Access denied, grab your coat and take her out for coffee.
	End If
  End Select


Each time you want to give another user access to the application, you need to extend the select case statement. In the long run, you can see the problems with this approach. The list will grow, and in some point of time it will be so large that is becomes harder and harder to maintain. On the other hand, if you provide a database with a users table in it, the code is simple and maintainable. All you need to do is provide procedures on how to add and delete users from the table (nice Administrator screen, etc.) The choice is up to you.

Grtz.©

M.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Get an imput on one form to write code in another


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway