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

Reference RunTime Control

Hi All. I must be missing something but I can't figure out how to do
this. In my form's onload event I am adding a label control at
runtime. I create the control by calling a sub that is in a module
that has the necessary code to create the label. This works fine but
later I want to resize this label -- how can I reference the label
that I created in the onload?

Thanks!

Jun 12 '07 #1
3 1114
On Jun 12, 1:21 pm, Joseph Gruber <joseph.gru...@gmail.comwrote:
Hi All. I must be missing something but I can't figure out how to do
this. In my form's onload event I am adding a label control at
runtime. I create the control by calling a sub that is in a module
that has the necessary code to create the label. This works fine but
later I want to resize this label -- how can I reference the label
that I created in the onload?

Thanks!
One option would be to use Me.Controls.Find("labelName").

Thanks,

Seth Rowe

Jun 12 '07 #2
On Jun 12, 1:35 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Jun 12, 1:21 pm, Joseph Gruber <joseph.gru...@gmail.comwrote:
Hi All. I must be missing something but I can't figure out how to do
this. In my form's onload event I am adding a label control at
runtime. I create the control by calling a sub that is in a module
that has the necessary code to create the label. This works fine but
later I want to resize this label -- how can I reference the label
that I created in the onload?
Thanks!

One option would be to use Me.Controls.Find("labelName").

Thanks,

Seth Rowe
Oooh that's really cool. Thanks! :)

Jun 12 '07 #3
Joseph Gruber wrote:
In my form's onload event I am adding a label control at
runtime. I create the control by calling a sub that is in a module
that has the necessary code to create the label.
A Label is an instance of an Object, just like any other.

Make your "AddALabel" Sub into a /Function/ and return the Label you
create and put on the Form:

Function AddALabel( frm As Form ) as Label
lbl = New Label
. . .
Return lbl
End Function

Save this value somewhere:

Dim dynLabel as Label _
= module1.AddALabel( Me )
This works fine but later I want to resize this label
how can I reference the label that I created in the onload?
Use the value you stored when the Label was created.

dynLabel.Size = New Size( 99, 99 )

HTH,
Phill W.
Jun 13 '07 #4

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

Similar topics

0
by: D. Yates | last post by:
Hi All, Say I have two controls Car and Driver. How do get a Car control to reference a Driver control on the properties tab? I'm not interested in changing Driver properties on assignment. ...
3
by: Tom | last post by:
Hi, I built a C# web application, all things are ok when i test locally. I deploy it to a remote server. I set <customErrors mode="Off" /> in web.config. One of the aspx page has the problem...
4
by: ffhansix | last post by:
Hi, I am trying to reference a COM component (.dll) from Visual Studio 2005 in my windows application in C# by adding a reference to a third party.dll file (tried .type library also), and i get...
14
by: 97T | last post by:
Well this is still bugging me. I know there are other ways around this, but for a number of reasons I would like to be able to do this one simple thing. I have a form with a number of controls...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
3
by: pleaseexplaintome_2 | last post by:
using the code below (some parts not included), I create a new excel workbook with spreadheets. I then want to delete a spreadsheet, but a reference remains open and excel stays in task manager...
4
by: johnxhc | last post by:
We have a project in .NET 1.1 , some of the .NET methods take COM interface reference pointer as a parameter, somehow we have to call Marshal.ReleaseComObject to release the COM Object, otherwise...
0
by: Patrick | last post by:
I have somehow created a reference to outlctl.dll. Everytime I move this file to another computer, I have to go and remove the missing reference to 'Microsoft Outlook View Control' because it keeps...
7
by: chage | last post by:
Hi, I have been searching around to try adding reference assembly to another assembly during runtime, programatically. Is this possible in .Net? The reason for this is because i am having...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
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...

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.