473,386 Members | 1,652 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,386 software developers and data experts.

How to see data from form1 in module1

I'm trying to make my app source easier to read & follow by breaking up
the code into modules. One module has the fileIO routines, another
module has the sockets routines, etc. However, I can't see any of the
data from the main form.

I need to send data entered into a textbox from form1 to a remote server
via a routine in the sockets module. However, I can't see the textbox
from the module.

This is probably really simple, and i'm probably still thinking in VB6
terms.

Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #1
7 1478
Hi,
Pass a reference to form1 when you call the procedures in the
module.
Module Test

Public Sub ShowText(ByVal frm As Form1)

MessageBox.Show(frm.TextBox1.Text)

End Sub

End Module

To use.

ShowText(Me)

Ken
--------------------
"Terry Olsen" <to******@hotmail.com> wrote in message
news:uF*************@TK2MSFTNGP09.phx.gbl...
I'm trying to make my app source easier to read & follow by breaking up
the code into modules. One module has the fileIO routines, another
module has the sockets routines, etc. However, I can't see any of the
data from the main form.

I need to send data entered into a textbox from form1 to a remote server
via a routine in the sockets module. However, I can't see the textbox
from the module.

This is probably really simple, and i'm probably still thinking in VB6
terms.

Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #2

"Terry Olsen" <to******@hotmail.com> wrote in message
news:uF*************@TK2MSFTNGP09.phx.gbl...
I'm trying to make my app source easier to read & follow by breaking up
the code into modules. One module has the fileIO routines, another
module has the sockets routines, etc. However, I can't see any of the
data from the main form.

I need to send data entered into a textbox from form1 to a remote server
via a routine in the sockets module. However, I can't see the textbox
from the module.


There are various options. You could declare the text box Friend instead of
Private in the don't-touch-this-or-we'll-break-your-fingers "Windows Form
Designer generated code" region. Be aware that this could get reset by the
designer.

A more elegant solution, besides passing the form reference as Ken
suggested, would be to create a property in Form1 that returns the value of
the text box.
Nov 21 '05 #3
Hitting from both sides of the plate?<g>
Nov 21 '05 #4
You dont have to change it within the designer code, there is an access
modifiers property for the textbox control, this is set to default as
Friend

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:Ok**************@TK2MSFTNGP11.phx.gbl...

"Terry Olsen" <to******@hotmail.com> wrote in message
news:uF*************@TK2MSFTNGP09.phx.gbl...
I'm trying to make my app source easier to read & follow by breaking up
the code into modules. One module has the fileIO routines, another
module has the sockets routines, etc. However, I can't see any of the
data from the main form.

I need to send data entered into a textbox from form1 to a remote server
via a routine in the sockets module. However, I can't see the textbox
from the module.
There are various options. You could declare the text box Friend instead

of Private in the don't-touch-this-or-we'll-break-your-fingers "Windows Form
Designer generated code" region. Be aware that this could get reset by the
designer.

A more elegant solution, besides passing the form reference as Ken
suggested, would be to create a property in Form1 that returns the value of the text box.

Nov 21 '05 #5
The tricks of visual inheritence are started to fall together...

Learn something everyday.

Thanks Terry!
Greg

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
You dont have to change it within the designer code, there is an access
modifiers property for the textbox control, this is set to default as
Friend

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:Ok**************@TK2MSFTNGP11.phx.gbl...

"Terry Olsen" <to******@hotmail.com> wrote in message
news:uF*************@TK2MSFTNGP09.phx.gbl...
I'm trying to make my app source easier to read & follow by breaking up the code into modules. One module has the fileIO routines, another
module has the sockets routines, etc. However, I can't see any of the
data from the main form.

I need to send data entered into a textbox from form1 to a remote server via a routine in the sockets module. However, I can't see the textbox
from the module.


There are various options. You could declare the text box Friend instead

of
Private in the don't-touch-this-or-we'll-break-your-fingers "Windows Form Designer generated code" region. Be aware that this could get reset by the designer.

A more elegant solution, besides passing the form reference as Ken
suggested, would be to create a property in Form1 that returns the value

of
the text box.


Nov 21 '05 #6

"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
You dont have to change it within the designer code, there is an access
modifiers property for the textbox control, this is set to default as
Friend


Oh, yeah. I've seen that. Apparently it didn't sink in....
Nov 21 '05 #7

"Al Reid" <ar*****@reidDASHhome.com> wrote in message
news:ey****************@TK2MSFTNGP11.phx.gbl...
Hitting from both sides of the plate?<g>


Shhhh!!
Nov 21 '05 #8

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

Similar topics

12
by: Casey | last post by:
Yeah, I know this question was asked by someone elselike 2 weeks ago. But I need some additional help. I have a program I'm developing, and multiple different forms will be opened. For now though,...
1
by: nic | last post by:
Hi I have two forms form1 and form2. I am trying to get all the data entered in form1 to be updated to the table on an event. ie. when I click the button to load form2, I need the data from...
2
by: Michael | last post by:
Hi Everyone, Please help me on this one. I have the following function: Public Sub SearchFor(ByRef mType As Module1.SearchForType, ByRef mValue As String) On Error GoTo Err_Handler Dim Proc As...
4
by: thomasp | last post by:
Using VB2005 Beta 2 If I use Application.Run(New Form1) in the below code. Then code like TAM.Form1.rtbAllAcq.Text = aryStatistics(0) that is used to update a richtextbox on Form1 does not work....
1
by: Terry Olsen | last post by:
I have a module that is called from Form1 that performs a long process. I have a Progressbar on Form1 that I need to increment to show the user that stuff is happening. I added this code to...
3
by: KCT | last post by:
The following class member function (DataClass.DataUpdate) is called by an event handler at periodic intervals. I want to increment the counter (Counter) each time it's called, but I don't know...
0
by: Anonymous | last post by:
Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <wfednQ6STZz2Z6faRVnytAA@bt.com> Lines: 15 X-Usenet-Provider: http://www.giganews.com...
2
by: Macias | last post by:
Hi, Please tell me how I can exchange data between two forms. My main form is Form1, and I display a new form something like this: private void Settings_Click(object sender, EventArgs e) { using...
2
by: cj2 | last post by:
How do I get the threads to update the richtextbox1 on form1? This isn't working. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.