473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

very new to vb.net

cwebs4u
picked up a book and probably not a good one but nonetheless, picked one up and trying to read the chapters and do the exercises in the back of each chapter (good gurl, right?)

well... im stuck on a question and was hoping someone could finish what i started and/or fix it and then explain to me why they finished it the way they did (any takers) ???

====================================

i gotta form and it has two buttons, one button named uiSalaryButton and the other named uiBonusButton

both buttons Click event procedures need to use the variable "employeeName" variable

i need to write an appropriate statement that declares the employeeName variable and specify where i would need to enter that statement AND whether or not it's procedure-level or module-level variable

ima start off and you can either correct, fix or tell me to bug off (or not)

Module-level:
Private employeeName as String = uiSalaryButton + uiBonusButton


thanx,
sharon
Feb 1 '07 #1
1 885
willakawill
1,646 1GB
Hi Sharon.
There are 2 ways to share a variable between procedures. One is to pass it from one procedure to another as a parameter and the other is to make the variable global in scope so that all procedures can 'see' it.

In your case the second route seems to be the best as you have discovered. All of the procedures in your module will 'see' this variable. You don't have to use special initializing syntax to make sure that the button onclick events can use this variable. As long as the event procedures are in the same module all will be well.

When you use the 'private' keyword you are limiting the scope to just that module. No other modules can see this variable. This is good. Unless you have a pressing reason to do so, it is normally poor programming to declare variiables that can be seen in all modules.

So the declaration:
Expand|Select|Wrap|Line Numbers
  1. Private employeeName As String
is all you need to put in your code module

If you post more code, we can give more assistance.
Good luck
Feb 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Raymond Arthur St. Marie II of III | last post by:
very Very VERY dumb ? about the new Set( ) 's Please be kind and read this like you know I've been up 33-34 hours reading PEP's but... Doc\ref 2.6 Delimiters show's three unused characters "@...
10
by: Eric S. Johansson | last post by:
I have an application where I need a very simple database, effectively a very large dictionary. The very large dictionary must be accessed from multiple processes simultaneously. I need to be...
8
by: alsemgeest | last post by:
Hi, I'd like to make my own very simple autorisation system. Just a table: tblUsers (user and pw). Next I need a form with user and pw in textbox, with an OK button. If the lookup fails: msgbox...
19
by: shanx__=|;- | last post by:
hi i need some help regarding use of very very long integer datatype in 'c'.. i need it to store result of large number's factorial.. if someone can healp it would be a delight..
2
by: Robert Hooker | last post by:
Hi, I'm curious to know if I'm doing something wrong here, or if this is just mind-numbingly slow for a reason. In a simple WindowsFormsApplication: public Form1() { // Required for...
50
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
33
by: dembla | last post by:
Hey Frnds can anyone help me in this i need a program in 'c' PROGRAM to print NxN Matrix 9 1 8 1 2 3 2 7 3 as 4 5 6 6 4 5 7 8 9 in sorted form
5
by: le007 | last post by:
:) Hey All, I've recently tried my hand with CSS. I know a good bit of html and thats more or less it. I've moved back to Ireland from Australia now and I'm trying to put a site together to keep...
3
by: cold80 | last post by:
I was just doing a performance test in order to see the benefit of using AJAX instead of doing a postback on the server. So I have a simple page that performs a request to the server and write a...
1
by: 6655326 | last post by:
Newbi needs a very small help, thank you very much. Hello everyone and thank you very much for your time. I Have a small db for invoicing and on my form (with a subform) there is a CANCEL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.