473,602 Members | 2,846 Online
Bytes | Software Development & Data Engineering Community
+ 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 2871
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.TextBox 1.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_lunch meat_[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
1564
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 to put an interactive userform in the website. Basically I have an MS Access Database set up so that I can pick a language pair, insert how many words, and then it will search the database and come back with a price, based on the info from the...
3
4952
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 additional calculations, they use the command button to bring up the second userform and add additional information via textboxes in the second form. However, the calculations need the data from both userforms. Given that the variables are...
2
3266
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 options and click next, userform2 will be activated. Thanks
2
1291
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 already so i could add to it.
2
12499
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 to the left of the active cell meets a certain condition and the active cell is in column 8. Problem: when conditions warrant, selection_change shows userform. when executed Excel locks. VBA editor indicates code is running but form can not be...
3
2126
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.", vbExclamation, "Document Reference" userform1.Hide userform1.Show Wend
1
4074
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 worksheet. I would like to have a txtBox that is used as a search field. When the user enters a number in the field it will search through column A of worksheet 1 for the value that was entered into the field. Once it is found I would like it to...
1
1432
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. I've tried going down the Alt - Print Screen route but I'm unable to get the SendKeys "%{PRTSC}" command to work. Any ideas Many thanks
2
1829
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 seem to be able to reference the combobox on the report. Any ideas round this apart from having a text box on userform which has text from combobox in it? Thanks
1
1511
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 form to relevant panel (group-box) in my main form, the borders do not show up. But I can see them if I Add->Remove->Add again this userform to the main form. can anybody suggest whats going on? -Hims
0
7993
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8054
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8268
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6730
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3900
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.