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

Detect Object Index

How can I detect if object with specific index exists?
E.g. I load text box and give it random index number between 0 and 5.
Now I have to set some text in textbox so I need to detect it but I
don't know what index I gave it!

Private Sub Form_Load()
Dim x As Integer
x = Rnd * 5
Load Text1(x)
End Sub

And I need to find out that x!
How can I do that?

By WhiteRavenEye <aka ColdFusion>

Jul 17 '05 #1
4 2380
on your form click on your text box then look at your properties it will
tell you the name of the object selected.
"WhiteRavenEye" <wh***********@hotmail.com> wrote in message
news:be**********@brown.net4u.hr...
How can I detect if object with specific index exists?
E.g. I load text box and give it random index number between 0 and 5.
Now I have to set some text in textbox so I need to detect it but I
don't know what index I gave it!

Private Sub Form_Load()
Dim x As Integer
x = Rnd * 5
Load Text1(x)
End Sub

And I need to find out that x!
How can I do that?

By WhiteRavenEye <aka ColdFusion>

Jul 17 '05 #2
In article <be**********@brown.net4u.hr>, WhiteRavenEye
<wh***********@hotmail.com> writes
How can I detect if object with specific index exists?
E.g. I load text box and give it random index number between 0 and 5.
Now I have to set some text in textbox so I need to detect it but I
don't know what index I gave it!

Private Sub Form_Load()
Dim x As Integer
x = Rnd * 5
Load Text1(x)
End Sub

And I need to find out that x!
How can I do that?


Something like this?

Dim ctlT As Control

For Each ctlT In Controls
If TypeOf ctlT Is TextBox And ctlT.Name = "Text1" Then _
Debug.Print ctlT.Index
Next ctlT
--
Roger Barker ro***@peaksys.co.uk
Boston, UK
Jul 17 '05 #3
Roger Barker wrote:
In article <be**********@brown.net4u.hr>, WhiteRavenEye
<wh***********@hotmail.com> writes
How can I detect if object with specific index exists?
E.g. I load text box and give it random index number between 0 and 5.
Now I have to set some text in textbox so I need to detect it but I
don't know what index I gave it!

Private Sub Form_Load()
Dim x As Integer
x = Rnd * 5
Load Text1(x)
End Sub

And I need to find out that x!
How can I do that?

Something like this?

Dim ctlT As Control

For Each ctlT In Controls
If TypeOf ctlT Is TextBox And ctlT.Name = "Text1" Then _
Debug.Print ctlT.Index
Next ctlT


Yes, yes, yes!!!!
That's exactly what I needed!
Thanks... You saved me a lot of headache...

By WhiteRavenEye <aka SysCold>

Jul 17 '05 #4
That's what I would have thought as well. Obviously some people chose
to ignore the simple stuff and go with the complicated - I suppose you
can make your program look more nerdy like that.
Samir Talwar

da***********@hotmail.com (David Wimbush) wrote in message news:<3c**************************@posting.google. com>...
Surely Don's suggestion of making a note of x in the first place is much better?

WhiteRavenEye <wh***********@hotmail.com> wrote in message news:<be**********@brown.net4u.hr>...
Roger Barker wrote:
In article <be**********@brown.net4u.hr>, WhiteRavenEye
<wh***********@hotmail.com> writes

>How can I detect if object with specific index exists?
>E.g. I load text box and give it random index number between 0 and 5.
>Now I have to set some text in textbox so I need to detect it but I
>don't know what index I gave it!
>
>Private Sub Form_Load()
>Dim x As Integer
>x = Rnd * 5
>Load Text1(x)
>End Sub
>
>And I need to find out that x!
>How can I do that?
Something like this?

Dim ctlT As Control

For Each ctlT In Controls
If TypeOf ctlT Is TextBox And ctlT.Name = "Text1" Then _
Debug.Print ctlT.Index
Next ctlT


Yes, yes, yes!!!!
That's exactly what I needed!
Thanks... You saved me a lot of headache...

By WhiteRavenEye <aka SysCold>

Jul 17 '05 #5

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

Similar topics

1
by: Jessica | last post by:
Hi, I'm sorry if this has been asked before. I'm a designer and occasional javascript hacker, not a javascript writer. I cannot believe I have spent over 4 hours searching for this on Google and...
20
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I detect Opera/Netscape/IE? ----------------------------------------------------------------------- The...
4
by: aotemp | last post by:
Does anyone know how to detect the version of Java installed? My website has an application that requires java 1.5+ to be installed, basically if the user doesn;t already have it installed I...
1
by: teo | last post by:
hallo In a DataGridView how/where may I detect the click on the header of a column versus the click on a cell "inside" the grid ? I tried by using the
11
by: jacob navia | last post by:
Hi Suppose that I want to create an array of read only items I overload the operator. How can I detect if I am being called within a read context foo = Array; or within a write context...
9
by: DotNetNewbie | last post by:
Hello, I need a simple hash algorithm that will detect duplicate content in my application. I want to hash not just the content, but a few other parameters also like EmployeeID and...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.