Greetings,
I searched for this, but cannot find exaclty what I am looking for. I am trying to dynamically create labels on a form just before it opens. I am reading from a database, building the labels then opening the form.
Currently I have put the labels (in a control array) on the form I want to receive the variables. Then I create a loop to read in the db and build the labels, then open the form.
I have like 300 control arrays to build, and would love to dynamically create everything.
the code I have thus far is: -
While Not rs.EOF
-
If IsNull(rs("Eclient")) = False Then
-
frmClientStatus.lblClient(i).Caption = rs("Eclient")
-
End If
-
Load frmClientStatus
-
With frmClientStatus
-
.lblTestClient (i)
-
.Left = "500"
-
.Top = "500"
-
.Caption = "test"
-
.Visible = True
-
End With
-
If IsNull(rs("InforceDate")) = False Then
-
frmClientStatus.InforceDate(i).Caption = rs("InforceDate")
-
End If
-
there are more if statements below, but I cut them out for brevity.
love to hear any ideas - thanks a mil.
Mark
8 2518
Hi. You have omitted the end of the while loop which is important in this context. Can you say what it is you are trying to achieve without talking about it in terms of a solution?
Thanks for the prompt response, yes I let off several steps below just for brevity sake. What I am trying to do is place labels on a form, poplate their caption with a database recordset, then open the form to display the status results.
Sorry - looking at it, I did not make that terribly clear eh?
thanks
Mark
We are still without the remainder of the loop. I know that you have said you left out parts that don't matter for brevity. You have also left out parts that do matter.
Are you planning to be displaying a different number of labels each time? Will this number of labels be unlimited?
Sorry I was trying to not clog up the screen with the code, here it is the entire routine. Yes the number of labels will or could change each time based on how many cllients are put in by each analyst.
The method below is where I actually went into the status form and created labels (in a control array) for each one (a pain). The parts that are commented out are the new method of dynamically creating the labels.
sorry for the confusion.
and thanks for the help
mark -
Begin Sub
-
Dim conn1 As ADODB.Connection
-
Set conn1 = New ADODB.Connection
-
Dim constr As String
-
Dim rs As ADODB.Recordset
-
Dim i As Integer
-
Dim lblClient() As Label
-
Dim lblCleanup() As Label
-
Dim lblAccess() As Label
-
Dim lblExcel() As Label
-
Dim lblSeriatim() As Label
-
Dim lblInforceDate() As Label
-
Dim Import() As Label
-
Dim lblResearch() As Label
-
Dim lblMaster() As Label
-
Dim lblCopyToClient() As Label
-
Dim lblRetrieveResearch() As Label
-
Dim lblDone() As Label
-
Dim lblTestClient() As Label
-
-
i = 0
-
constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=L:\vbfolder\????.mdb"
-
conn1.Open constr
-
Set rs = conn1.Execute("Select * from InforceLog WHERE AnalystName = '" & cboSelectName.Text & "'")
-
-
-
While Not rs.EOF
-
If IsNull(rs("Eclient")) = False Then
-
frmClientStatus.lblClient(i).Caption = rs("Eclient")
-
End If
-
'Load frmClientStatus
-
'With frmClientStatus
-
' .lblTestClient (i)
-
' .Left = "500"
-
' .Top = "500"
-
' .Caption = "test"
-
' .Visible = True
-
'End With
-
If IsNull(rs("InforceDate")) = False Then
-
frmClientStatus.InforceDate(i).Caption = rs("InforceDate")
-
End If
-
If IsNull(rs("Cleanup")) = False Then
-
frmClientStatus.lblCleanup(i).Caption = rs("Cleanup")
-
End If
-
If IsNull(rs("Accessdb")) = False Then
-
frmClientStatus.lblAccess(i).Caption = rs("Accessdb")
-
End If
-
If IsNull(rs("Excel")) = False Then
-
frmClientStatus.lblExcel(i).Caption = rs("Excel")
-
End If
-
If IsNull(rs("seriatim")) = False Then
-
frmClientStatus.lblSeriatim(i).Caption = rs("Seriatim")
-
End If
-
If IsNull(rs("ImportSeriatim")) = False Then
-
frmClientStatus.Import(i).Caption = rs("ImportSeriatim")
-
End If
-
If IsNull(rs("Research")) = False Then
-
frmClientStatus.lblResearch(i).Caption = rs("Research")
-
End If
-
If IsNull(rs("RetrieveResearch")) = False Then
-
frmClientStatus.lblRetrieveResearch(i).Caption = rs("RetrieveResearch")
-
End If
-
If IsNull(rs("UploadToMaster")) = False Then
-
frmClientStatus.lblMaster(i).Caption = rs("UploadToMaster")
-
End If
-
If IsNull(rs("Eclientcopy")) = False Then
-
frmClientStatus.lblCopyToClient(i).Caption = rs("EclientCopy")
-
End If
-
-
If IsNull(rs("Eclient")) = False And IsNull(rs("InforceDate")) = False And IsNull(rs("Accessdb")) = False And IsNull(rs("Excel")) = False And IsNull(rs("Seriatim")) = False And IsNull(rs("ImportSeriatim")) = False And IsNull(rs("UploadToMaster")) = False And IsNull(rs("EclientCopy")) = False Then
-
frmClientStatus.lblDone(i).Caption = "*"
-
End If
-
-
i = i + 1
-
rs.MoveNext
-
Wend
-
If cboSelectName.Text = "" Then
-
MsgBox "Please select name before continuing", vbOKOnly + vbInformation
-
Exit Sub
-
End If
-
-
frmClientStatus.Show
-
Set conn1 = Nothing
-
Set rs = Nothing
-
-
frmClientStatus.Show
-
-
end sub
-
And the second part of this question:
Are you planning to be displaying a different number of labels each time? Will this number of labels be unlimited?
The labels for each run are laid out in a grid format
Client Date Step1 Step2 Step3 Step4 .......
XXX xx/xx/xx * * * *
this is the basic layout of the data once the code has run. the headers across are constant, the amount of clients going down is not unlimited however it could range from just 5 or 6 to 30 - 40, but never more than that.
Thanks again for your response ...
Mark
Then, perhaps, a listbox or datagrid would be a better tool for you
Yes agreed,
I am looking into flexgrid now, what I have thus far will work temporarily, I just need to find a flexgrid solution before too long...
thanks so much for your time
Mark
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Bil Muh |
last post by:
Esteemede Developers,
I would like to Thank All of You in advance for your sincere guidances.
I am developing a software using Visual C++ .NET Standard Edition with
Windows Form (.NET) template.
Briefly
--------------------------------------------------------------------------------------------
I need to create dynamically some controls on the forms, and display these
|
by: pizzy |
last post by:
PROBLEM: I CAN'T GET THE LAST RESUTS TO WORK CORRECTLY. I WOULD
PROVIDE THE CODE (AND WILL IF REQUESTED).
BUT IN MY OWN WORDS I AM TRYING TO HAVE THE FIRST FORM
DYNAMICALLY CREATE INPUT BOXES BASED ON THE NUMBER
ENTERED. THEN ON THE SECOND FORM (WHICH IS CREATED BY
THE FIRST FORM CALLING A FUNCTION) I WANT THE USER TO BE
ABLE TO CLICK ON ONE OF THE CHECKBOXES AND SEE MORE
INPUT BOXES APPEAR. HAS ANYONE DONE SOMETHING LIKE THIS?
IF SO,...
|
by: hzgt9b |
last post by:
Is it possible to dynamically add controls (speciifcally
System.Windows.Forms.ProgressBar and System.Windows.Forms.Label) to a panel
to a form and have them display (and fucntion) at run time?
I've been trying todo this by creating arrays of progressbars and labels.
Then for each item in the root nods of a treeView that I need to track
progress on, I create a bar and label and add them to a panel. The problem is
that when I display the...
|
by: Nathan Bloomfield |
last post by:
Does anyone know if there is any documentation which relates to Access2k + ?
or can anyone help adjust the code?
I am having trouble converting the DAO references.
TITLE :INF: How to Create a Dynamic Crosstab Report
PRODUCT :Microsoft Access
PROD/VER:1.00 1.10
OPER/SYS:WINDOWS
|
by: Mike Collins |
last post by:
I have a web form that has most of the UI designed. On this form, some of the
labels, textboxes, dropdowns, etc. will be added dynamically, depending on
what extra bits of data the user decides they want to see. The question I
have is when retrieving the dynamic fields for my form, should I get
everything in one grab (dynamic fields and data) or keep the form dataset
separate from the actual data dataset? Also, please excuse my ignorance,...
| |
by: Steve Funk |
last post by:
All, I have searched all around and have not yet found the answer to this nor
a solution. Hopfully it will be easy to overcome.
Here is what I am trying to do:
I'm trying to build a wizard form completely dynamic. I'm adding the
labels, textboxes, drop downs, radio buttons, etc dynamically. I am able to
add them via Page Init. Which seems to re-add every time a button or post
back is initiated. Don't know if this is the problem.
|
by: anniejacob |
last post by:
hi,
I am making a dynamic form which i have to put some labels which r 2 b dynamic.n i have to make 'n' number of labels dynamically.
label me = new label();
This is the line im using to make it. how do i pass the value of 'n' in the code.
if someone can help me 2 do this.
|
by: prokopis |
last post by:
am using c# for windows applications.
am using dynamic linklayer array to print some labels in the form.i get some data from the database i add them in the linklabel array and i print it on the screen.
my problem is how to make that linklabel to work when i select the label.am using the code below but is not working:)
public class Form1 : Form
{
System.Windows.Forms.LinkLabel linklabel;
|
by: libish |
last post by:
hi all...
can any one help me by suggesting a way to get items in dynamic form?
here what i'm doing is , i'm displaying a dynamic form. in that form i have a main menu and this main menu contains a menu item "OK". here the dynamic form consist of some labels, list items and all. when i click on the "OK" menu item, an event occurs and i've wrote methods which wll execute on this event.
now i need the selected list item index,value.. label...
|
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,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |