473,471 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

UserForm <-> Module TextBox share

Simple question. I'm a VBA programmer who has just switched to VB .net. I'm
using a UserForm called Form1 with a text box called TextBox1.

I'd like to reference the number in the text box in the module called Engine
by using the following statement

Dim num as Double
num = Form1.TextBox1.Value

However, I can not see the TextBox1 after I finish typing "Form1". What's
going on?
Nov 21 '05 #1
2 2863
Marknanh,

Start setting option strict on in top of your program, in the beginning it
will give some problems and than you can for a while set it to off. Using it
helps you to find errors and gives programs which process faster.

The code
Dim num as Double
num = Form1.TextBox1.Value

should be

Dim num as Double
num = Cdbl(me.TextBox1.Text)

Which says

Set the value in the textbox in my class (me), which is your form, as a
double value in the field num.

I hope this helps?

Cor
Nov 21 '05 #2
On Wed, 8 Sep 2004 15:03:08 -0700, Marknanh wrote:
Simple question. I'm a VBA programmer who has just switched to VB .net. I'm
using a UserForm called Form1 with a text box called TextBox1.

I'd like to reference the number in the text box in the module called Engine
by using the following statement

Dim num as Double
num = Form1.TextBox1.Value

However, I can not see the TextBox1 after I finish typing "Form1". What's
going on?


In addition to Cor's comment, is "Form1" the name of the instance of your
form? Or is it the name of the form class?

In other words, did you do something like this anywhere:

Dim Form1 As New UserForm

num = Form1.TextBox1.Text

If Form1 is the name of your form *class* then you must get the value of
the textbox using an *instance* of the class and not the class name.

HTH a little

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Continental Translations | last post by:
Not too sure if this is the correct NG, but here goes.... I am in the process of creating a website (http://www.continental-translations.com - well someone is creating it for me) and I am hoping...
3
by: gw.boswell | last post by:
I have created a userform with textboxes for data entry. I also have a command button that calls a second useform. A user enters certain information in the first useform but if he/she wants to do...
2
by: williamyeow | last post by:
Hi i am new to excel VB. can anyone tell me how to link userform to another userform? My concept for my program I have set up a userform with a couple of option. after the user has chose the...
2
by: golf32902 | last post by:
i have a button on sheet 1 and i would like the userform to insert the text i input into sheet 2. And if there is a way the next time i access the userform that is inserts wha i have in the cell...
2
by: hapnendad | last post by:
I am using a selection_change event on a worksheet to launch a userform that will populate the cell when a selection is made from a drop down list box on the form. Selection_change shows form if cell...
3
by: fcgp1985 | last post by:
Hi, I have created a command button that validates information on the userform. For example: While textbox1.Text = "" MsgBox "Please enter the reference of the document.",...
1
by: brenty66 | last post by:
I have a userform that is used as an interface for information stored on excel spreadsheets. The user enters bits of information into fields on the userform which are place on the corresponding...
1
by: Pippy Parker | last post by:
I've created a Userform within an Excel session which is populated by various pieces of info. What I'm looking to do is exported the Userform into a jpeg which I then can attach to a e - mail. ...
2
by: JC2710 | last post by:
Hi I have a userform which has criteria entered into it from a combobox. It then runs a report from this form. I would like to display the text entered in combobox on the report. However I dont...
1
by: hsachdevah | last post by:
Hello, I have created a table layout container in a userform and each of its cells contains a label. I have set the table border property to 'single'. But the problem is when I Add this user...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.