How can i read a double value from a textbox?

NerdyGurl

Member
Joined
Apr 19, 2007
Messages
7
Location
Auckland, NZ
Programming Experience
Beginner
Hi there, i was wondering how do i read a double value from a text box?
And im having some trouble with a program i have to do for my course, Ihave my class, and my subs but for each sub i want to use variables from another but i keep getting an error saying i need to declare them but there are allready declared in the first sub?? if i declare them under class instead of in a sub would that help? would i still be able to access the data in the calculation sub??
(Sorry quite new at this)
Cheers,
Jess
 
VB.NET:
Expand Collapse Copy
Dim d As Double
If Double.TryParse(Textbox1.Text, d) Then 'success
Variable scope can be class which is higher than local method scope, but it is better Object Oriented Programming to pass around variable values between methods that need them, doing it through method parameters - that is, if the variables is not key properties (private or public) of the class itself. You don't commonly put everything you need to store at class level making it one big repository.
 
No, I didn't mean the programming keyword Property, those are used for access between class instances.
 
variables

declare your variables at form , class or module level.

i.e.

Public Class Form1

Public yourVariable As Integer

end class

yourVariable will be available in all subs in that form.
 
Or you could write the value to a file, it will be available to all applications on system! You can even make your harddisk shared and open the firewall to have it available to all internet users throughout the world :p;):D:rolleyes::cool:
 
ROFL@John
icon14.gif
icon14.gif
icon14.gif
 
Back
Top