473,386 Members | 1,908 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.

Module accessing a forms controls

102 64KB
I have a form named CurrentFY that has a groupbox on it. The groupbox name is gpb_PDF. CurrentFY calls a module named Excel2PDF. Can I reference the gpb_PDF while in Excel2PDF and if it can how do I go about it?

Thanks in advance.
Mar 20 '17 #1

✓ answered by IronRazer

You should pass the GroupBox control to the sub or function in the Module through a parameter. For example, in the Module you would add a parameter to the sub/function like this...
Expand|Select|Wrap|Line Numbers
  1. Module Module1
  2.     Public Sub DoSomething(gbx As GroupBox)
  3.  
  4.         gbx.BackColor = Color.Red 'access the GroupBox through the (gbx) parameter
  5.  
  6.     End Sub
  7. End Module
  8.  
Then from the Form, you would pass the GroupBox to the sub/function when you call it...
Expand|Select|Wrap|Line Numbers
  1.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2.         Module1.DoSomething(GroupBox1)
  3.     End Sub
  4.  

2 1208
Luk3r
300 256MB
Absolutely. Just specify the groupbox like this within your module:
Expand|Select|Wrap|Line Numbers
  1. CurrentFY.gpb_PDF.Text
Mar 20 '17 #2
IronRazer
83 64KB
You should pass the GroupBox control to the sub or function in the Module through a parameter. For example, in the Module you would add a parameter to the sub/function like this...
Expand|Select|Wrap|Line Numbers
  1. Module Module1
  2.     Public Sub DoSomething(gbx As GroupBox)
  3.  
  4.         gbx.BackColor = Color.Red 'access the GroupBox through the (gbx) parameter
  5.  
  6.     End Sub
  7. End Module
  8.  
Then from the Form, you would pass the GroupBox to the sub/function when you call it...
Expand|Select|Wrap|Line Numbers
  1.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2.         Module1.DoSomething(GroupBox1)
  3.     End Sub
  4.  
Mar 21 '17 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: jusa | last post by:
Hi, I wold like to get to a .Net apps forms/controls/properties. I've managed to start an app with Process.Start but can not figure out if possible/how to get to the started form. I would like...
0
by: Guowei Yang | last post by:
I'm a chinese c# user,now I'm writing a program of visiting SQL server.When I placed a DataGrid control in my web form and browsed it in IE,I couldn't find any record of database.Other web forms...
5
by: Jonathan Williams | last post by:
Hi, I have an object which inherits from WebControl (CUSTOM : WebControl) In this object I have code in which I add child contols: protected override void CreateChildControls() {...
4
by: Dean Slindee | last post by:
Is there a shorter way of referring to another forms controls/events than creating a class hold forms, adding a form item each time a new form is loaded, and then looping thru the class of forms to...
2
by: Phil | last post by:
Hi all, If I remember correctly, in VB you can refer to your controls from a module simply by referring to ControlContainer, ie. Form1.Textbox1.Text = "something". I have added a module to my...
3
by: Gene Hubert | last post by:
Is there a way to Visually Design Windows Forms Controls? For example, I have a class that inherits TextBox. Can I see a property sheet and a rendition of what it will look like as I develop...
2
by: =?Utf-8?B?bGFyc2dyZWdlcnNlbg==?= | last post by:
Hi I have created a couple of Windows Forms controls in C# either by composition or by subclassing existing controls. I'm able to use these controls as ActiveX controls by using "register for...
3
by: Andy B | last post by:
Is there any way to use .net windows forms controls inside asp.net pages and not require that the client have .net access? I'm more the less thinking of mobile devices that don't have access to, or...
2
by: Andy B | last post by:
Is there any way to use .net windows forms controls inside asp.net pages and not require that the client have .net access? I'm more the less thinking of mobile devices that don't have access to, or...
1
by: thomasjbs | last post by:
Anyone know a consistent object reference to forms controls? I have 2 forms. The main form instantiates a 2nd form, creates some text and label objects on the 2nd form, hides itself and then...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.