Macro Substitution or ReFlection


Author
Message
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
I have a FrmGetPayOff with TabControl1 on it. On page1 of tabcontrol1 I have several labels with names lbl1go, lbl2go, lbl3go, ...

I would like to fill them with some numeric data found in an array ngopercents().

I have tried to follow some samples found in the forum but if I use the Ctype below it tells me I am missing an object and if I use the last several examples using an object the object in the line  below ends up to be nothing and of course produces and error. What am I doing wrong in this code or how do I get the correct object?

loObj = Me.TabControl1.TabPages(1).Controls("lbl" & i.ToString + "go")

Dim i As Integer = 0

Dim j As Integer = 0

Dim loObj As Object

For j = 0 To (nnumofplaces - 1)

i = j + 1

' CType(Me.Controls("lbl" & i.ToString + "go"), Label).Text = ngopercents(j).ToString + "%"

' CType(Me.Controls("txt" & i.ToString + "go"), Label).Text = ngoresults(j).ToString("C")

' loObj = Me.TabControl1.TabPages.Controls("lbl" & i.ToString + "go")

' loObj = Windows.Forms.TabControl.TabPageCollection.Controls("lbl" & i.ToString + "go")

' loObj = frmCalcPayOffs.TabControl1.TabPages(1).Controls("lbl" & i.ToString + "go")

loObj = Me.TabControl1.TabPages(1).Controls("lbl" & i.ToString + "go")

loObj.GetType().GetProperty("Text").SetValue(loObj, ngopercents(j), Nothing)

Next

TIA.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search