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

how to get an object by its name

I need to convert a form in vb6 with several named "lbcol1","lbcol2",...
"lbcol" and so onn array of label
the funtion that in vb6 was alright was:
Private Function GimmeLabel(Index As Integer, Nome As Integer) As VB.Label
Dim Obj As Object
For Each Obj In Me.Controls

If Obj.name = "lbcol" + CStr(Nome) Then
If Obj.Index = Index Then
Set DammiLabel = Obj
Exit For
End If
End If
Next
End Function
How to translate in vb.net
More in general isThere a function in vb.net equlvalent to the
java/actionscript function eval
Thanks best regards
Davide

Jan 3 '06 #1
3 1277
Accessing controls by their names or indices
http://dotnet.mvps.org/dotnet/faqs/?...eindex&lang=en

There is no built in equivalent to eval() in VB.NET

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/

"DavideR" <Da*****@discussions.microsoft.com> wrote in message
news:27**********************************@microsof t.com...
I need to convert a form in vb6 with several named "lbcol1","lbcol2",...
"lbcol" and so onn array of label
the funtion that in vb6 was alright was:
Private Function GimmeLabel(Index As Integer, Nome As Integer) As VB.Label
Dim Obj As Object
For Each Obj In Me.Controls

If Obj.name = "lbcol" + CStr(Nome) Then
If Obj.Index = Index Then
Set DammiLabel = Obj
Exit For
End If
End If
Next
End Function
How to translate in vb.net
More in general isThere a function in vb.net equlvalent to the
java/actionscript function eval
Thanks best regards
Davide

Jan 3 '06 #2
well but The problem is that that i search by name lbcol1 that is defined as
vb6.labelarray that is not a control i need to find the labelarray first
the labelarray class seems don't have got the name property...
any idea don't rewriting all code?
"Rob Windsor [MVP]" wrote:
Accessing controls by their names or indices
http://dotnet.mvps.org/dotnet/faqs/?...eindex&lang=en

There is no built in equivalent to eval() in VB.NET

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/

"DavideR" <Da*****@discussions.microsoft.com> wrote in message
news:27**********************************@microsof t.com...
I need to convert a form in vb6 with several named "lbcol1","lbcol2",...
"lbcol" and so onn array of label
the funtion that in vb6 was alright was:
Private Function GimmeLabel(Index As Integer, Nome As Integer) As VB.Label
Dim Obj As Object
For Each Obj In Me.Controls

If Obj.name = "lbcol" + CStr(Nome) Then
If Obj.Index = Index Then
Set DammiLabel = Obj
Exit For
End If
End If
Next
End Function
How to translate in vb.net
More in general isThere a function in vb.net equlvalent to the
java/actionscript function eval
Thanks best regards
Davide


Jan 3 '06 #3
I would assume if you want to keep with the same logic then look at the link
Rob provided which also points to "Creating control Arrays in VB.NET" via
MSDN. Another thought would be to find controls with a specific prefix using
the FindControl function listed in the primary link.

"DavideR" <Da*****@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
well but The problem is that that i search by name lbcol1 that is defined
as
vb6.labelarray that is not a control i need to find the labelarray first
the labelarray class seems don't have got the name property...
any idea don't rewriting all code?
"Rob Windsor [MVP]" wrote:
Accessing controls by their names or indices
http://dotnet.mvps.org/dotnet/faqs/?...eindex&lang=en

There is no built in equivalent to eval() in VB.NET

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/

"DavideR" <Da*****@discussions.microsoft.com> wrote in message
news:27**********************************@microsof t.com...
>I need to convert a form in vb6 with several named "lbcol1","lbcol2",...
> "lbcol" and so onn array of label
> the funtion that in vb6 was alright was:
> Private Function GimmeLabel(Index As Integer, Nome As Integer) As
> VB.Label
> Dim Obj As Object
> For Each Obj In Me.Controls
>
> If Obj.name = "lbcol" + CStr(Nome) Then
> If Obj.Index = Index Then
> Set DammiLabel = Obj
> Exit For
> End If
> End If
> Next
> End Function
> How to translate in vb.net
> More in general isThere a function in vb.net equlvalent to the
> java/actionscript function eval
> Thanks best regards
> Davide
>


Jan 3 '06 #4

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

Similar topics

18
by: Steven Bethard | last post by:
In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of...
9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
54
by: tshad | last post by:
I have a function: function SalaryDisplay(me) { var salaryMinLabel = document.getElementById("SalaryMin"); salaryMinLabel.value = 200; alert("after setting salaryMinLabel = " +...
2
by: Aaron | last post by:
I have a data sructure setup and I populate it in a loop like so: y=0 while X: DS.name = "ASDF" DS.ID = 1234 list = DS; y = y + 1
5
by: Matthew | last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML file. I call it like so: Dim mySettings As mySettings = New mySettings mySettings.value1 = "someText" mySettings.value2...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
11
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
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: 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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.