473,325 Members | 2,860 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,325 software developers and data experts.

How to reference a control from another vb.net form?

Hi all,

I have a checkbox cboxProcessRet in my VB.NET windows application's
main.vb as following, so how can I use reference this checkbox in
moduleA.vb?

I want to use it in a function in the module, it said cboxProcessRet
is not declared
(If cboxProcessRet.Checked = True )
------------------------------------------------------------------------

Public Class frmMain
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private components As System.ComponentModel.IContainer
Friend WithEvents cboxProcessRet As System.Windows.Forms.CheckBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.cboxProcessRet = New System.Windows.Forms.CheckBox

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 21 '05 #1
2 10680
je**********@hotmail-dot-com.no-spam.invalid (JenHu) wrote in news:41b883b4
$1**@Usenet.com:
I have a checkbox cboxProcessRet in my VB.NET windows application's
main.vb as following, so how can I use reference this checkbox in
moduleA.vb?


Is the control declared as public? If it is, you can access it directly.

Rather than create a public control, create a property to change the value
of the control.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #2
Your post is titled "Form" to Form" and the text says "Module" which is it?

Here's form to form

FormA:

Private Sub butshowotherform_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles butShowOtherForm.Click

Dim fb As New FormB
fb.ShowDialog()
MsgBox(fb.ThisIsTheCheckBox.Checked.ToString)
fb.Dispose()
fb = Nothing
End Sub
public readonly property ThisIsMyCheckBox() as checkbox

FormB:

Friend ReadOnly Property ThisIsTheCheckBox() As CheckBox
Get
Return chkMyBox
End Get
End Property

That passes the checkbox. You could also just expose a BoxIsChecked
property thaqt returns a bool.

Hope that helps

smith
"JenHu" <je**********@hotmail-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
Hi all,

I have a checkbox cboxProcessRet in my VB.NET windows application's
main.vb as following, so how can I use reference this checkbox in
moduleA.vb?

I want to use it in a function in the module, it said cboxProcessRet
is not declared
(If cboxProcessRet.Checked = True )
------------------------------------------------------------------------

Public Class frmMain
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private components As System.ComponentModel.IContainer
Friend WithEvents cboxProcessRet As System.Windows.Forms.CheckBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.cboxProcessRet = New System.Windows.Forms.CheckBox

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 21 '05 #3

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

Similar topics

11
by: Vanessa | last post by:
Hi, I would like to know whether there's any way for me to pass an object by reference to another form? Regards Vanessa
12
by: Bill Todd | last post by:
Form B needs to call a public method of Form A. How can form B get a reference to the instance of Form A using its name or any other method? Is there a collection of form instances that can be...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
4
by: JeremyI | last post by:
The form I am working on at the moment is designed to allow a data entry person to add new questions for the assessment of some properties. I am trying to set up cascading combo boxes that force the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.