473,401 Members | 2,125 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,401 software developers and data experts.

arraylist - childmdifrm.Activate - how?

In a Parent mdi form I have a datagrid. I select a record
from the grid and then invoke a childmdi form. I add the
childmdi to an arraylist to keep track of it. If a user
has selected multiple records from the grid and has
multiple childmdi forms open and then re-selects a
previously selected record, I want to activate that
childmdi form. Suppose the arraylist contains indexes
0,1,2,3,4 (5 childmdi forms). A user re-selects a child
at index 2. How can I activate that childform?
Pseudocode:
dim arrayfrms As New Arraylist
....
arrayfrms(2).Activate

TIA
Adda
Nov 20 '05 #1
5 1527
Thank you all for not holding my hand on this one :).
Here is what I tried that seems to work:

Dim i As Integer = arrEditNum.BinarySearch(drg1
(cma.Position, 0))
Dim frm As frmEdit = CType(arrEditfrm(i), frmEdit)
frm.Activate()

So I get the position of the record on the grid from the
currency manager and the ID value (at column 0 on the
grid). But I am using 2 arraylists. One list contains
the IDs and the 2nd arraylist contains the forms. I was
thinking about creating a small class object to contain
both items (ID and frm) so I could search on the ID
property and then invoke/activate the frm property of my
little class object in the arraylist. but back to square
one:

i = arrObj(??).BinarySearch(...)
Dim frm as...(arrObj(??))

Any suggestions how to get the values of my class object
from the arrylist greatly appreciated.

Adda

-----Original Message-----
In a Parent mdi form I have a datagrid. I select a recordfrom the grid and then invoke a childmdi form. I add the
childmdi to an arraylist to keep track of it. If a user
has selected multiple records from the grid and has
multiple childmdi forms open and then re-selects a
previously selected record, I want to activate that
childmdi form. Suppose the arraylist contains indexes
0,1,2,3,4 (5 childmdi forms). A user re-selects a child
at index 2. How can I activate that childform?
Pseudocode:
dim arrayfrms As New Arraylist
....
arrayfrms(2).Activate

TIA
Adda
.

Nov 20 '05 #2
What about using a Hashtable. You can add an ID/form pair. And that way
you can index into the hashtable directly by the ID of the row, to get the
corresponding form, and you don't need to keep multiple lists.

"Adda" <an*******@discussions.microsoft.com> wrote in message
news:1b*****************************@phx.gbl...
Thank you all for not holding my hand on this one :).
Here is what I tried that seems to work:

Dim i As Integer = arrEditNum.BinarySearch(drg1
(cma.Position, 0))
Dim frm As frmEdit = CType(arrEditfrm(i), frmEdit)
frm.Activate()

So I get the position of the record on the grid from the
currency manager and the ID value (at column 0 on the
grid). But I am using 2 arraylists. One list contains
the IDs and the 2nd arraylist contains the forms. I was
thinking about creating a small class object to contain
both items (ID and frm) so I could search on the ID
property and then invoke/activate the frm property of my
little class object in the arraylist. but back to square
one:

i = arrObj(??).BinarySearch(...)
Dim frm as...(arrObj(??))

Any suggestions how to get the values of my class object
from the arrylist greatly appreciated.

Adda

-----Original Message-----
In a Parent mdi form I have a datagrid. I select a

record
from the grid and then invoke a childmdi form. I add the
childmdi to an arraylist to keep track of it. If a user
has selected multiple records from the grid and has
multiple childmdi forms open and then re-selects a
previously selected record, I want to activate that
childmdi form. Suppose the arraylist contains indexes
0,1,2,3,4 (5 childmdi forms). A user re-selects a child
at index 2. How can I activate that childform?
Pseudocode:
dim arrayfrms As New Arraylist
....
arrayfrms(2).Activate

TIA
Adda
.

Nov 20 '05 #3
This seems like a good idea. May I ask how I retrieve the
value part of the hashtable?

Dim myHT as Hashtable
myHT.Add(0, child)
....
myHT.Add(1, child)
....
myHT.Add(2, child)
....

Now to activate child form at position 1

Dim frm As frmChild = CType(myHT(?), frmChild)
frm.Activate

Thanks for your reply.
Adda
-----Original Message-----
What about using a Hashtable. You can add an ID/form pair. And that wayyou can index into the hashtable directly by the ID of the row, to get thecorresponding form, and you don't need to keep multiple lists.
"Adda" <an*******@discussions.microsoft.com> wrote in messagenews:1b*****************************@phx.gbl...
Thank you all for not holding my hand on this one :).
Here is what I tried that seems to work:

Dim i As Integer = arrEditNum.BinarySearch(drg1
(cma.Position, 0))
Dim frm As frmEdit = CType(arrEditfrm(i), frmEdit)
frm.Activate()

So I get the position of the record on the grid from the
currency manager and the ID value (at column 0 on the
grid). But I am using 2 arraylists. One list contains
the IDs and the 2nd arraylist contains the forms. I was
thinking about creating a small class object to contain
both items (ID and frm) so I could search on the ID
property and then invoke/activate the frm property of my
little class object in the arraylist. but back to square one:

i = arrObj(??).BinarySearch(...)
Dim frm as...(arrObj(??))

Any suggestions how to get the values of my class object
from the arrylist greatly appreciated.

Adda

>-----Original Message-----
>In a Parent mdi form I have a datagrid. I select a

record
>from the grid and then invoke a childmdi form. I add the >childmdi to an arraylist to keep track of it. If a user >has selected multiple records from the grid and has
>multiple childmdi forms open and then re-selects a
>previously selected record, I want to activate that
>childmdi form. Suppose the arraylist contains indexes
>0,1,2,3,4 (5 childmdi forms). A user re-selects a child >at index 2. How can I activate that childform?
>Pseudocode:
>dim arrayfrms As New Arraylist
>....
>arrayfrms(2).Activate
>
>TIA
>Adda
>.
>

.

Nov 20 '05 #4
You have the code correct. You would index it by the ID you gave it when you
added the item. So, 0, 1, or 2 in your case, since you added 3 items, with
those keys. Basically, the first parameter to Add it the key, the second is
the value. So whatever the key was that you are looking for.

Hashtable has complete documentation.

"Adda" <an*******@discussions.microsoft.com> wrote in message
news:1c*****************************@phx.gbl...
This seems like a good idea. May I ask how I retrieve the
value part of the hashtable?

Dim myHT as Hashtable
myHT.Add(0, child)
...
myHT.Add(1, child)
...
myHT.Add(2, child)
...

Now to activate child form at position 1

Dim frm As frmChild = CType(myHT(?), frmChild)
frm.Activate

Thanks for your reply.
Adda
-----Original Message-----
What about using a Hashtable. You can add an ID/form

pair. And that way
you can index into the hashtable directly by the ID of

the row, to get the
corresponding form, and you don't need to keep multiple

lists.

"Adda" <an*******@discussions.microsoft.com> wrote in

message
news:1b*****************************@phx.gbl...
Thank you all for not holding my hand on this one :).
Here is what I tried that seems to work:

Dim i As Integer = arrEditNum.BinarySearch(drg1
(cma.Position, 0))
Dim frm As frmEdit = CType(arrEditfrm(i), frmEdit)
frm.Activate()

So I get the position of the record on the grid from the
currency manager and the ID value (at column 0 on the
grid). But I am using 2 arraylists. One list contains
the IDs and the 2nd arraylist contains the forms. I was
thinking about creating a small class object to contain
both items (ID and frm) so I could search on the ID
property and then invoke/activate the frm property of my
little class object in the arraylist. but back to square one:

i = arrObj(??).BinarySearch(...)
Dim frm as...(arrObj(??))

Any suggestions how to get the values of my class object
from the arrylist greatly appreciated.

Adda
>-----Original Message-----
>In a Parent mdi form I have a datagrid. I select a
record
>from the grid and then invoke a childmdi form. I add the >childmdi to an arraylist to keep track of it. If a user >has selected multiple records from the grid and has
>multiple childmdi forms open and then re-selects a
>previously selected record, I want to activate that
>childmdi form. Suppose the arraylist contains indexes
>0,1,2,3,4 (5 childmdi forms). A user re-selects a child >at index 2. How can I activate that childform?
>Pseudocode:
>dim arrayfrms As New Arraylist
>....
>arrayfrms(2).Activate
>
>TIA
>Adda
>.
>

.

Nov 20 '05 #5
This worked perfectly! Many thanks for your help.

Adda

-----Original Message-----
You have the code correct. You would index it by the ID you gave it when youadded the item. So, 0, 1, or 2 in your case, since you added 3 items, withthose keys. Basically, the first parameter to Add it the key, the second isthe value. So whatever the key was that you are looking for.
Hashtable has complete documentation.

"Adda" <an*******@discussions.microsoft.com> wrote in messagenews:1c*****************************@phx.gbl...
This seems like a good idea. May I ask how I retrieve the value part of the hashtable?

Dim myHT as Hashtable
myHT.Add(0, child)
...
myHT.Add(1, child)
...
myHT.Add(2, child)
...

Now to activate child form at position 1

Dim frm As frmChild = CType(myHT(?), frmChild)
frm.Activate

Thanks for your reply.
Adda
>-----Original Message-----
>What about using a Hashtable. You can add an ID/form

pair. And that way
>you can index into the hashtable directly by the ID of

the row, to get the
>corresponding form, and you don't need to keep multiple

lists.
>
>"Adda" <an*******@discussions.microsoft.com> wrote in

message
>news:1b*****************************@phx.gbl...
>> Thank you all for not holding my hand on this one :).
>> Here is what I tried that seems to work:
>>
>> Dim i As Integer = arrEditNum.BinarySearch(drg1
>> (cma.Position, 0))
>> Dim frm As frmEdit = CType(arrEditfrm(i), frmEdit)
>> frm.Activate()
>>
>> So I get the position of the record on the grid from the >> currency manager and the ID value (at column 0 on the
>> grid). But I am using 2 arraylists. One list contains >> the IDs and the 2nd arraylist contains the forms. I was >> thinking about creating a small class object to contain >> both items (ID and frm) so I could search on the ID
>> property and then invoke/activate the frm property of my >> little class object in the arraylist. but back to

square
>> one:
>>
>> i = arrObj(??).BinarySearch(...)
>> Dim frm as...(arrObj(??))
>>
>> Any suggestions how to get the values of my class object >> from the arrylist greatly appreciated.
>>
>> Adda
>>
>>
>> >-----Original Message-----
>> >In a Parent mdi form I have a datagrid. I select a
>> record
>> >from the grid and then invoke a childmdi form. I add
the
>> >childmdi to an arraylist to keep track of it. If a

user
>> >has selected multiple records from the grid and has
>> >multiple childmdi forms open and then re-selects a
>> >previously selected record, I want to activate that
>> >childmdi form. Suppose the arraylist contains

indexes >> >0,1,2,3,4 (5 childmdi forms). A user re-selects a

child
>> >at index 2. How can I activate that childform?
>> >Pseudocode:
>> >dim arrayfrms As New Arraylist
>> >....
>> >arrayfrms(2).Activate
>> >
>> >TIA
>> >Adda
>> >.
>> >
>
>
>.
>

.

Nov 20 '05 #6

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

Similar topics

1
by: geotso | last post by:
Hi I'm looking for a script to activate a different stylesheet for a page, according the link a visitor clicks on. More specific, I have a page with a topic, divided into three sub-topics. I...
4
by: bughunter | last post by:
In version 7.x connect to db activate db db SQL1494W Activate database is successful, however, there is already a connection to the database. works fine - db activated. In 8.x - No!...
2
by: Randy Harris | last post by:
I'm working with Access 2K and seem to be getting some behavior that contradicts the documentation. First, the help says: "Note The Activate event doesn't occur when a form receives focus back...
7
by: Alex Ting | last post by:
Hi Everybody, I have an issue about deleting an object from an arrayList. I've bounded a datagrid using this code where it will first run through all of the code in loadQuestions() and bind a...
3
by: george r smith | last post by:
I am trying to create an arrayList that contains multiple arrayLists. My code attempt is below. The question I have is how can I get away from creating another pAttribute list than can be added to...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
6
by: fniles | last post by:
I am using VB.NET 2003 and a socket control to receive and sending data to clients. As I receive data in 1 thread, I put it into an arraylist, and then I remove the data from arraylist and send it...
3
by: Christopher H | last post by:
I've been reading about how C# passes ArrayLists as reference and Structs as value, but I still can't get my program to work like I want it to. Simple example: ...
4
by: =?Utf-8?B?YmFzdWxhc3o=?= | last post by:
Hi; I want to store a datatable (or an arraylist) as a session variable but when I try; Session = al_RecNo; I get an error that; "Cannot implicitly convert type...
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: 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: 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
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,...
0
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...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
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...

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.