Connecting Tech Pros Worldwide Forums | Help | Site Map

Duplicating Objects

EdB
Guest
 
Posts: n/a
#1: Nov 21 '05
I'm still having trouble grasping what's going on here and how to resolve it.

In VB6 I have a form that has several combo boxes with lots of items in
each; it takes a long time to load the form because of having to load each
combobox. As I think about converting this to .Net, I believe I should be
able to do something like this:

'position & load the primary object
ComboBox1.Top = 40
ComboBox1.Left = 8
Dim intLoop As Integer
For intLoop = 1 To 5000
ComboBox1.Items.Add(intLoop)
Next

'define & place the copy
Dim cbo2 As New ComboBox
cbo2 = ComboBox1
cbo2.Top = 80
cbo2.Left = 8
cbo2.Text = "ComboBox2"
Me.Controls.Add(cbo2)

But the statement

cbo2 = ComboBox1

doesn't do what I expect. When I view the form, I only see one combobox.
It's like by setting them equal, they become one.

What is the proper way to accomplish this task?

Ken Tucker [MVP]
Guest
 
Posts: n/a
#2: Nov 21 '05

re: Duplicating Objects


Hi,

You are not creating a new combobox1. You are making cbo2 reference
combobox1.

Ken
------------------------
"EdB" <EdB@discussions.microsoft.com> wrote in message
news:5B1DF6F0-F20B-4CD7-A50C-08A7BBFA525E@microsoft.com...
I'm still having trouble grasping what's going on here and how to resolve
it.

In VB6 I have a form that has several combo boxes with lots of items in
each; it takes a long time to load the form because of having to load each
combobox. As I think about converting this to .Net, I believe I should be
able to do something like this:

'position & load the primary object
ComboBox1.Top = 40
ComboBox1.Left = 8
Dim intLoop As Integer
For intLoop = 1 To 5000
ComboBox1.Items.Add(intLoop)
Next

'define & place the copy
Dim cbo2 As New ComboBox
cbo2 = ComboBox1
cbo2.Top = 80
cbo2.Left = 8
cbo2.Text = "ComboBox2"
Me.Controls.Add(cbo2)

But the statement

cbo2 = ComboBox1

doesn't do what I expect. When I view the form, I only see one combobox.
It's like by setting them equal, they become one.

What is the proper way to accomplish this task?


Mike McIntyre
Guest
 
Posts: n/a
#3: Nov 21 '05

re: Duplicating Objects


EdB,

One approach is to use one ComboBox but call BeginUpdate just before adding
items, and call EndUpdate after adding items.

See:
http://msdn.microsoft.com/library/de...ssaddtopic.asp

Dim intLoop As Integer
ComboBox1.BeginUpdate
For intLoop = 0 To 5000
ComboBox1.Items.Add(intLoop)
Next
ComboBox1.EndUpdate

--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"EdB" <EdB@discussions.microsoft.com> wrote in message
news:5B1DF6F0-F20B-4CD7-A50C-08A7BBFA525E@microsoft.com...[color=blue]
> I'm still having trouble grasping what's going on here and how to resolve
> it.
>
> In VB6 I have a form that has several combo boxes with lots of items in
> each; it takes a long time to load the form because of having to load each
> combobox. As I think about converting this to .Net, I believe I should be
> able to do something like this:
>
> 'position & load the primary object
> ComboBox1.Top = 40
> ComboBox1.Left = 8
> Dim intLoop As Integer
> For intLoop = 1 To 5000
> ComboBox1.Items.Add(intLoop)
> Next
>
> 'define & place the copy
> Dim cbo2 As New ComboBox
> cbo2 = ComboBox1
> cbo2.Top = 80
> cbo2.Left = 8
> cbo2.Text = "ComboBox2"
> Me.Controls.Add(cbo2)
>
> But the statement
>
> cbo2 = ComboBox1
>
> doesn't do what I expect. When I view the form, I only see one combobox.
> It's like by setting them equal, they become one.
>
> What is the proper way to accomplish this task?[/color]


EdB
Guest
 
Posts: n/a
#4: Nov 21 '05

re: Duplicating Objects


That does not solve my problem. Populating one combobox is not an issue.
Having just one combobox is not an option.

Am I going down a path that does not exist?

Are you (and Ken) saying that I can not set up a source combobox, with all
it's entries, then copy it in total and use the copy independently from the
source?

"Mike McIntyre" wrote:
[color=blue]
> EdB,
>
> One approach is to use one ComboBox but call BeginUpdate just before adding
> items, and call EndUpdate after adding items.
>
> See:
> http://msdn.microsoft.com/library/de...ssaddtopic.asp
>
> Dim intLoop As Integer
> ComboBox1.BeginUpdate
> For intLoop = 0 To 5000
> ComboBox1.Items.Add(intLoop)
> Next
> ComboBox1.EndUpdate
>
> --
> Mike
>
> Mike McIntyre
> Visual Basic MVP
> www.getdotnetcode.com
>
> "EdB" <EdB@discussions.microsoft.com> wrote in message
> news:5B1DF6F0-F20B-4CD7-A50C-08A7BBFA525E@microsoft.com...[color=green]
> > I'm still having trouble grasping what's going on here and how to resolve
> > it.
> >
> > In VB6 I have a form that has several combo boxes with lots of items in
> > each; it takes a long time to load the form because of having to load each
> > combobox. As I think about converting this to .Net, I believe I should be
> > able to do something like this:
> >
> > 'position & load the primary object
> > ComboBox1.Top = 40
> > ComboBox1.Left = 8
> > Dim intLoop As Integer
> > For intLoop = 1 To 5000
> > ComboBox1.Items.Add(intLoop)
> > Next
> >
> > 'define & place the copy
> > Dim cbo2 As New ComboBox
> > cbo2 = ComboBox1
> > cbo2.Top = 80
> > cbo2.Left = 8
> > cbo2.Text = "ComboBox2"
> > Me.Controls.Add(cbo2)
> >
> > But the statement
> >
> > cbo2 = ComboBox1
> >
> > doesn't do what I expect. When I view the form, I only see one combobox.
> > It's like by setting them equal, they become one.
> >
> > What is the proper way to accomplish this task?[/color]
>
>
>[/color]
Mike McIntyre
Guest
 
Posts: n/a
#5: Nov 21 '05

re: Duplicating Objects


EdB,

I am not saying "you can not set up a source combobox, with all it's
entries, then copy it in total and use the copy independently from the
source".

What I proposed is a common solution to optimizing the loading of
ComboBoxes.

There are other techniques too, but at this point I think I don't understand
your goal clearly.

What is the purpose of loading the ComboBoxes the way you outlined?

Is it to let the rest of the form load and be viewable immediately while
several ComboBoxes build in the background and become useable when they are
filled?

If that is the case you can use asynchronous delegates (one way to thread).

As the form loads your calls the delegate(s) that fill the ComboBoxe(s). The
delegates start building the ComboBoxes in the background and do not
interfer with loading the rest of the form. You can start with the
ComboBoxes disabled. You can have the delegate(s) call back to a procedure
in your code each time a ComboBox is filled and the procedure can enable the
ComboBox.

Or, please clarify your goal and we will see what we can do. ;-)


--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com


"EdB" <EdB@discussions.microsoft.com> wrote in message
news:EBC75246-1126-4E40-9062-6437750EF176@microsoft.com...[color=blue]
> That does not solve my problem. Populating one combobox is not an issue.
> Having just one combobox is not an option.
>
> Am I going down a path that does not exist?
>
> Are you (and Ken) saying that I can not set up a source combobox, with all
> it's entries, then copy it in total and use the copy independently from
> the
> source?
>
> "Mike McIntyre" wrote:
>[color=green]
>> EdB,
>>
>> One approach is to use one ComboBox but call BeginUpdate just before
>> adding
>> items, and call EndUpdate after adding items.
>>
>> See:
>> http://msdn.microsoft.com/library/de...ssaddtopic.asp
>>
>> Dim intLoop As Integer
>> ComboBox1.BeginUpdate
>> For intLoop = 0 To 5000
>> ComboBox1.Items.Add(intLoop)
>> Next
>> ComboBox1.EndUpdate
>>
>> --
>> Mike
>>
>> Mike McIntyre
>> Visual Basic MVP
>> www.getdotnetcode.com
>>
>> "EdB" <EdB@discussions.microsoft.com> wrote in message
>> news:5B1DF6F0-F20B-4CD7-A50C-08A7BBFA525E@microsoft.com...[color=darkred]
>> > I'm still having trouble grasping what's going on here and how to
>> > resolve
>> > it.
>> >
>> > In VB6 I have a form that has several combo boxes with lots of items in
>> > each; it takes a long time to load the form because of having to load
>> > each
>> > combobox. As I think about converting this to .Net, I believe I should
>> > be
>> > able to do something like this:
>> >
>> > 'position & load the primary object
>> > ComboBox1.Top = 40
>> > ComboBox1.Left = 8
>> > Dim intLoop As Integer
>> > For intLoop = 1 To 5000
>> > ComboBox1.Items.Add(intLoop)
>> > Next
>> >
>> > 'define & place the copy
>> > Dim cbo2 As New ComboBox
>> > cbo2 = ComboBox1
>> > cbo2.Top = 80
>> > cbo2.Left = 8
>> > cbo2.Text = "ComboBox2"
>> > Me.Controls.Add(cbo2)
>> >
>> > But the statement
>> >
>> > cbo2 = ComboBox1
>> >
>> > doesn't do what I expect. When I view the form, I only see one
>> > combobox.
>> > It's like by setting them equal, they become one.
>> >
>> > What is the proper way to accomplish this task?[/color]
>>
>>
>>[/color][/color]


Cor Ligthert
Guest
 
Posts: n/a
#6: Nov 21 '05

re: Duplicating Objects


EdB,

Are you searching for this?
\\\
ComboBox1.Top = 40
ComboBox1.Left = 8
Dim intLoop As Integer
For intLoop = 1 To 5000
ComboBox1.Items.Add(intLoop)
Next
Dim cbo2 As New ComboBox
cbo2.Top = 80
cbo2.Left = 8
cbo2.Text = "ComboBox2"
Dim myarray(ComboBox1.Items.Count - 1) As Object
ComboBox1.Items.CopyTo(myarray, 0)
cbo2.Items.AddRange(myarray)
Me.Controls.Add(cbo2)
///

http://msdn.microsoft.com/library/de...opytotopic.asp

I hope this helps?

Cor

"EdB" <EdB@discussions.microsoft.com>
[color=blue]
> I'm still having trouble grasping what's going on here and how to resolve
> it.
>
> In VB6 I have a form that has several combo boxes with lots of items in
> each; it takes a long time to load the form because of having to load each
> combobox. As I think about converting this to .Net, I believe I should be
> able to do something like this:
>
> 'position & load the primary object
> ComboBox1.Top = 40
> ComboBox1.Left = 8
> Dim intLoop As Integer
> For intLoop = 1 To 5000
> ComboBox1.Items.Add(intLoop)
> Next
>
> 'define & place the copy
> Dim cbo2 As New ComboBox
> cbo2 = ComboBox1
> cbo2.Top = 80
> cbo2.Left = 8
> cbo2.Text = "ComboBox2"
> Me.Controls.Add(cbo2)
>
> But the statement
>
> cbo2 = ComboBox1
>
> doesn't do what I expect. When I view the form, I only see one combobox.
> It's like by setting them equal, they become one.
>
> What is the proper way to accomplish this task?[/color]


Mike McIntyre
Guest
 
Posts: n/a
#7: Nov 21 '05

re: Duplicating Objects


Cor,

Or to avoid the overhead of building a CombBox to build the data:


Dim integers(4999) As Object

Dim i As Integer
For i = 0 To 4999
integers(i) = i
Next

Me.ComboBox1.Items.AddRange(integers)

Mike

"Cor Ligthert" <notmyfirstname@planet.nl> wrote in message news:ebklSuu1EHA.1564@TK2MSFTNGP09.phx.gbl...[color=blue]
> EdB,
>
> Are you searching for this?
> \\\
> ComboBox1.Top = 40
> ComboBox1.Left = 8
> Dim intLoop As Integer
> For intLoop = 1 To 5000
> ComboBox1.Items.Add(intLoop)
> Next
> Dim cbo2 As New ComboBox
> cbo2.Top = 80
> cbo2.Left = 8
> cbo2.Text = "ComboBox2"
> Dim myarray(ComboBox1.Items.Count - 1) As Object
> ComboBox1.Items.CopyTo(myarray, 0)
> cbo2.Items.AddRange(myarray)
> Me.Controls.Add(cbo2)
> ///
>
> http://msdn.microsoft.com/library/de...opytotopic.asp
>
> I hope this helps?
>
> Cor
>
> "EdB" <EdB@discussions.microsoft.com>
> [color=green]
>> I'm still having trouble grasping what's going on here and how to resolve
>> it.
>>
>> In VB6 I have a form that has several combo boxes with lots of items in
>> each; it takes a long time to load the form because of having to load each
>> combobox. As I think about converting this to .Net, I believe I should be
>> able to do something like this:
>>
>> 'position & load the primary object
>> ComboBox1.Top = 40
>> ComboBox1.Left = 8
>> Dim intLoop As Integer
>> For intLoop = 1 To 5000
>> ComboBox1.Items.Add(intLoop)
>> Next
>>
>> 'define & place the copy
>> Dim cbo2 As New ComboBox
>> cbo2 = ComboBox1
>> cbo2.Top = 80
>> cbo2.Left = 8
>> cbo2.Text = "ComboBox2"
>> Me.Controls.Add(cbo2)
>>
>> But the statement
>>
>> cbo2 = ComboBox1
>>
>> doesn't do what I expect. When I view the form, I only see one combobox.
>> It's like by setting them equal, they become one.
>>
>> What is the proper way to accomplish this task? [/color]
>
>[/color]
Cor Ligthert
Guest
 
Posts: n/a
#8: Nov 21 '05

re: Duplicating Objects


Mike,

True, however my purpose of the sample was to show the tocopy.

However the solution could be even shorter with what you wrote.

:-)

Cor

EdB
Guest
 
Posts: n/a
#9: Nov 21 '05

re: Duplicating Objects


I appreciate the help. Let me give more detail as to the application and
then perhaps you'll reccommend a best approach.

The application is for a national courier company. Drivers get paid for
routes they run on given days. At the end of the week, a settlement
(compensation) process occurs. While most of the information is set for the
user, exceptions must be dealt with.

So, for each day of the week, there is a combo box populated with all the
routes that exist within a given geographic area. In more dense areas, there
can be lots of routes. The screen takes a long time to paint for these
"terminals" because I am populating the SundayRoute, MondayRoute,
TuesdayRoute, etc... combo boxes.

I need one for each day because a driver may do one route on Monday, another
on Tuesday. The day by day comboboxes are very intuitive to the user.

Since the content is all the same for each, I figured I could populate one,
then copy. I'm afraid that the copyto won't reduce the overhead.


"Mike McIntyre" wrote:
[color=blue]
> EdB,
>
> I am not saying "you can not set up a source combobox, with all it's
> entries, then copy it in total and use the copy independently from the
> source".
>
> What I proposed is a common solution to optimizing the loading of
> ComboBoxes.
>
> There are other techniques too, but at this point I think I don't understand
> your goal clearly.
>
> What is the purpose of loading the ComboBoxes the way you outlined?
>
> Is it to let the rest of the form load and be viewable immediately while
> several ComboBoxes build in the background and become useable when they are
> filled?
>
> If that is the case you can use asynchronous delegates (one way to thread).
>
> As the form loads your calls the delegate(s) that fill the ComboBoxe(s). The
> delegates start building the ComboBoxes in the background and do not
> interfer with loading the rest of the form. You can start with the
> ComboBoxes disabled. You can have the delegate(s) call back to a procedure
> in your code each time a ComboBox is filled and the procedure can enable the
> ComboBox.
>
> Or, please clarify your goal and we will see what we can do. ;-)
>
>
> --
> Mike
>
> Mike McIntyre
> Visual Basic MVP
> www.getdotnetcode.com
>
>
> "EdB" <EdB@discussions.microsoft.com> wrote in message
> news:EBC75246-1126-4E40-9062-6437750EF176@microsoft.com...[color=green]
> > That does not solve my problem. Populating one combobox is not an issue.
> > Having just one combobox is not an option.
> >
> > Am I going down a path that does not exist?
> >
> > Are you (and Ken) saying that I can not set up a source combobox, with all
> > it's entries, then copy it in total and use the copy independently from
> > the
> > source?
> >
> > "Mike McIntyre" wrote:
> >[color=darkred]
> >> EdB,
> >>
> >> One approach is to use one ComboBox but call BeginUpdate just before
> >> adding
> >> items, and call EndUpdate after adding items.
> >>
> >> See:
> >> http://msdn.microsoft.com/library/de...ssaddtopic.asp
> >>
> >> Dim intLoop As Integer
> >> ComboBox1.BeginUpdate
> >> For intLoop = 0 To 5000
> >> ComboBox1.Items.Add(intLoop)
> >> Next
> >> ComboBox1.EndUpdate
> >>
> >> --
> >> Mike
> >>
> >> Mike McIntyre
> >> Visual Basic MVP
> >> www.getdotnetcode.com
> >>
> >> "EdB" <EdB@discussions.microsoft.com> wrote in message
> >> news:5B1DF6F0-F20B-4CD7-A50C-08A7BBFA525E@microsoft.com...
> >> > I'm still having trouble grasping what's going on here and how to
> >> > resolve
> >> > it.
> >> >
> >> > In VB6 I have a form that has several combo boxes with lots of items in
> >> > each; it takes a long time to load the form because of having to load
> >> > each
> >> > combobox. As I think about converting this to .Net, I believe I should
> >> > be
> >> > able to do something like this:
> >> >
> >> > 'position & load the primary object
> >> > ComboBox1.Top = 40
> >> > ComboBox1.Left = 8
> >> > Dim intLoop As Integer
> >> > For intLoop = 1 To 5000
> >> > ComboBox1.Items.Add(intLoop)
> >> > Next
> >> >
> >> > 'define & place the copy
> >> > Dim cbo2 As New ComboBox
> >> > cbo2 = ComboBox1
> >> > cbo2.Top = 80
> >> > cbo2.Left = 8
> >> > cbo2.Text = "ComboBox2"
> >> > Me.Controls.Add(cbo2)
> >> >
> >> > But the statement
> >> >
> >> > cbo2 = ComboBox1
> >> >
> >> > doesn't do what I expect. When I view the form, I only see one
> >> > combobox.
> >> > It's like by setting them equal, they become one.
> >> >
> >> > What is the proper way to accomplish this task?
> >>
> >>
> >>[/color][/color]
>
>
>[/color]
Mike McIntyre
Guest
 
Posts: n/a
#10: Nov 21 '05

re: Duplicating Objects


EdB,

I am starting to see a solution. I need a little more clarification:

When you say 'Since the content is the same for each' does this mean each
combo box holds the same data as the next? For example, using a number
series as an example of route data:

MondayComboBox Items
1
2
3
4

TuesdayComboBox Items
1
2
3
4

WednesdayComboBox Items
1
2
3
4
5

and the same for Thursday, Friday, etc.?

Is the operation on the screen to, for one driver - pick one route for
Monday, one route for Tuesday, and so on?

Can you give an example of the real data? Is it really numbers you showed
in your original example? If not what is actually shown for each route item
in the ComboBox.

Mike




"EdB" <EdB@discussions.microsoft.com> wrote in message
news:AFA2E5E8-A333-4A04-AA56-7D173DDB8950@microsoft.com...[color=blue]
>I appreciate the help. Let me give more detail as to the application and
> then perhaps you'll reccommend a best approach.
>
> The application is for a national courier company. Drivers get paid for
> routes they run on given days. At the end of the week, a settlement
> (compensation) process occurs. While most of the information is set for
> the
> user, exceptions must be dealt with.
>
> So, for each day of the week, there is a combo box populated with all the
> routes that exist within a given geographic area. In more dense areas,
> there
> can be lots of routes. The screen takes a long time to paint for these
> "terminals" because I am populating the SundayRoute, MondayRoute,
> TuesdayRoute, etc... combo boxes.
>
> I need one for each day because a driver may do one route on Monday,
> another
> on Tuesday. The day by day comboboxes are very intuitive to the user.
>
> Since the content is all the same for each, I figured I could populate
> one,
> then copy. I'm afraid that the copyto won't reduce the overhead.
>
>
> "Mike McIntyre" wrote:
>[color=green]
>> EdB,
>>
>> I am not saying "you can not set up a source combobox, with all it's
>> entries, then copy it in total and use the copy independently from the
>> source".
>>
>> What I proposed is a common solution to optimizing the loading of
>> ComboBoxes.
>>
>> There are other techniques too, but at this point I think I don't
>> understand
>> your goal clearly.
>>
>> What is the purpose of loading the ComboBoxes the way you outlined?
>>
>> Is it to let the rest of the form load and be viewable immediately while
>> several ComboBoxes build in the background and become useable when they
>> are
>> filled?
>>
>> If that is the case you can use asynchronous delegates (one way to
>> thread).
>>
>> As the form loads your calls the delegate(s) that fill the ComboBoxe(s).
>> The
>> delegates start building the ComboBoxes in the background and do not
>> interfer with loading the rest of the form. You can start with the
>> ComboBoxes disabled. You can have the delegate(s) call back to a
>> procedure
>> in your code each time a ComboBox is filled and the procedure can enable
>> the
>> ComboBox.
>>
>> Or, please clarify your goal and we will see what we can do. ;-)
>>
>>
>> --
>> Mike
>>
>> Mike McIntyre
>> Visual Basic MVP
>> www.getdotnetcode.com
>>
>>
>> "EdB" <EdB@discussions.microsoft.com> wrote in message
>> news:EBC75246-1126-4E40-9062-6437750EF176@microsoft.com...[color=darkred]
>> > That does not solve my problem. Populating one combobox is not an
>> > issue.
>> > Having just one combobox is not an option.
>> >
>> > Am I going down a path that does not exist?
>> >
>> > Are you (and Ken) saying that I can not set up a source combobox, with
>> > all
>> > it's entries, then copy it in total and use the copy independently from
>> > the
>> > source?
>> >
>> > "Mike McIntyre" wrote:
>> >
>> >> EdB,
>> >>
>> >> One approach is to use one ComboBox but call BeginUpdate just before
>> >> adding
>> >> items, and call EndUpdate after adding items.
>> >>
>> >> See:
>> >> http://msdn.microsoft.com/library/de...ssaddtopic.asp
>> >>
>> >> Dim intLoop As Integer
>> >> ComboBox1.BeginUpdate
>> >> For intLoop = 0 To 5000
>> >> ComboBox1.Items.Add(intLoop)
>> >> Next
>> >> ComboBox1.EndUpdate
>> >>
>> >> --
>> >> Mike
>> >>
>> >> Mike McIntyre
>> >> Visual Basic MVP
>> >> www.getdotnetcode.com
>> >>
>> >> "EdB" <EdB@discussions.microsoft.com> wrote in message
>> >> news:5B1DF6F0-F20B-4CD7-A50C-08A7BBFA525E@microsoft.com...
>> >> > I'm still having trouble grasping what's going on here and how to
>> >> > resolve
>> >> > it.
>> >> >
>> >> > In VB6 I have a form that has several combo boxes with lots of items
>> >> > in
>> >> > each; it takes a long time to load the form because of having to
>> >> > load
>> >> > each
>> >> > combobox. As I think about converting this to .Net, I believe I
>> >> > should
>> >> > be
>> >> > able to do something like this:
>> >> >
>> >> > 'position & load the primary object
>> >> > ComboBox1.Top = 40
>> >> > ComboBox1.Left = 8
>> >> > Dim intLoop As Integer
>> >> > For intLoop = 1 To 5000
>> >> > ComboBox1.Items.Add(intLoop)
>> >> > Next
>> >> >
>> >> > 'define & place the copy
>> >> > Dim cbo2 As New ComboBox
>> >> > cbo2 = ComboBox1
>> >> > cbo2.Top = 80
>> >> > cbo2.Left = 8
>> >> > cbo2.Text = "ComboBox2"
>> >> > Me.Controls.Add(cbo2)
>> >> >
>> >> > But the statement
>> >> >
>> >> > cbo2 = ComboBox1
>> >> >
>> >> > doesn't do what I expect. When I view the form, I only see one
>> >> > combobox.
>> >> > It's like by setting them equal, they become one.
>> >> >
>> >> > What is the proper way to accomplish this task?
>> >>
>> >>
>> >>[/color]
>>
>>
>>[/color][/color]


Mike McIntyre
Guest
 
Posts: n/a
#11: Nov 21 '05

re: Duplicating Objects


EdB,

I am leaving for a project meeting.

If you want send the information to mikemc@getdotnetcode.com. I won't be
checking this newsgroup until tomorrow AM but I will be checking my email
several times today.


--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com\
"EdB" <EdB@discussions.microsoft.com> wrote in message
news:AFA2E5E8-A333-4A04-AA56-7D173DDB8950@microsoft.com...[color=blue]
>I appreciate the help. Let me give more detail as to the application and
> then perhaps you'll reccommend a best approach.
>
> The application is for a national courier company. Drivers get paid for
> routes they run on given days. At the end of the week, a settlement
> (compensation) process occurs. While most of the information is set for
> the
> user, exceptions must be dealt with.
>
> So, for each day of the week, there is a combo box populated with all the
> routes that exist within a given geographic area. In more dense areas,
> there
> can be lots of routes. The screen takes a long time to paint for these
> "terminals" because I am populating the SundayRoute, MondayRoute,
> TuesdayRoute, etc... combo boxes.
>
> I need one for each day because a driver may do one route on Monday,
> another
> on Tuesday. The day by day comboboxes are very intuitive to the user.
>
> Since the content is all the same for each, I figured I could populate
> one,
> then copy. I'm afraid that the copyto won't reduce the overhead.
>
>
> "Mike McIntyre" wrote:
>[color=green]
>> EdB,
>>
>> I am not saying "you can not set up a source combobox, with all it's
>> entries, then copy it in total and use the copy independently from the
>> source".
>>
>> What I proposed is a common solution to optimizing the loading of
>> ComboBoxes.
>>
>> There are other techniques too, but at this point I think I don't
>> understand
>> your goal clearly.
>>
>> What is the purpose of loading the ComboBoxes the way you outlined?
>>
>> Is it to let the rest of the form load and be viewable immediately while
>> several ComboBoxes build in the background and become useable when they
>> are
>> filled?
>>
>> If that is the case you can use asynchronous delegates (one way to
>> thread).
>>
>> As the form loads your calls the delegate(s) that fill the ComboBoxe(s).
>> The
>> delegates start building the ComboBoxes in the background and do not
>> interfer with loading the rest of the form. You can start with the
>> ComboBoxes disabled. You can have the delegate(s) call back to a
>> procedure
>> in your code each time a ComboBox is filled and the procedure can enable
>> the
>> ComboBox.
>>
>> Or, please clarify your goal and we will see what we can do. ;-)
>>
>>
>> --
>> Mike
>>
>> Mike McIntyre
>> Visual Basic MVP
>> www.getdotnetcode.com
>>
>>
>> "EdB" <EdB@discussions.microsoft.com> wrote in message
>> news:EBC75246-1126-4E40-9062-6437750EF176@microsoft.com...[color=darkred]
>> > That does not solve my problem. Populating one combobox is not an
>> > issue.
>> > Having just one combobox is not an option.
>> >
>> > Am I going down a path that does not exist?
>> >
>> > Are you (and Ken) saying that I can not set up a source combobox, with
>> > all
>> > it's entries, then copy it in total and use the copy independently from
>> > the
>> > source?
>> >
>> > "Mike McIntyre" wrote:
>> >
>> >> EdB,
>> >>
>> >> One approach is to use one ComboBox but call BeginUpdate just before
>> >> adding
>> >> items, and call EndUpdate after adding items.
>> >>
>> >> See:
>> >> http://msdn.microsoft.com/library/de...ssaddtopic.asp
>> >>
>> >> Dim intLoop As Integer
>> >> ComboBox1.BeginUpdate
>> >> For intLoop = 0 To 5000
>> >> ComboBox1.Items.Add(intLoop)
>> >> Next
>> >> ComboBox1.EndUpdate
>> >>
>> >> --
>> >> Mike
>> >>
>> >> Mike McIntyre
>> >> Visual Basic MVP
>> >> www.getdotnetcode.com
>> >>
>> >> "EdB" <EdB@discussions.microsoft.com> wrote in message
>> >> news:5B1DF6F0-F20B-4CD7-A50C-08A7BBFA525E@microsoft.com...
>> >> > I'm still having trouble grasping what's going on here and how to
>> >> > resolve
>> >> > it.
>> >> >
>> >> > In VB6 I have a form that has several combo boxes with lots of items
>> >> > in
>> >> > each; it takes a long time to load the form because of having to
>> >> > load
>> >> > each
>> >> > combobox. As I think about converting this to .Net, I believe I
>> >> > should
>> >> > be
>> >> > able to do something like this:
>> >> >
>> >> > 'position & load the primary object
>> >> > ComboBox1.Top = 40
>> >> > ComboBox1.Left = 8
>> >> > Dim intLoop As Integer
>> >> > For intLoop = 1 To 5000
>> >> > ComboBox1.Items.Add(intLoop)
>> >> > Next
>> >> >
>> >> > 'define & place the copy
>> >> > Dim cbo2 As New ComboBox
>> >> > cbo2 = ComboBox1
>> >> > cbo2.Top = 80
>> >> > cbo2.Left = 8
>> >> > cbo2.Text = "ComboBox2"
>> >> > Me.Controls.Add(cbo2)
>> >> >
>> >> > But the statement
>> >> >
>> >> > cbo2 = ComboBox1
>> >> >
>> >> > doesn't do what I expect. When I view the form, I only see one
>> >> > combobox.
>> >> > It's like by setting them equal, they become one.
>> >> >
>> >> > What is the proper way to accomplish this task?
>> >>
>> >>
>> >>[/color]
>>
>>
>>[/color][/color]


Larry Serflaten
Guest
 
Posts: n/a
#12: Nov 21 '05

re: Duplicating Objects



"EdB" <EdB@discussions.microsoft.com> wrote
[color=blue]
> I need one for each day because a driver may do one route on Monday, another
> on Tuesday. The day by day comboboxes are very intuitive to the user.
>
> Since the content is all the same for each, I figured I could populate one,
> then copy. I'm afraid that the copyto won't reduce the overhead.[/color]

Are you sure combo boxes would be more intuitive than a grid? With the
week days as the columns, and the routes as the rows, where checkmarks
indicate which route was taken, it would be pretty intuitive to know how to
use that interface. Plus with an option (you'd add) to view only the selected
routes, the entire week could be verified at a glance.

And what if, one day, a driver pulls two routes in one day?

For an example grid, check out this link:
http://www.vbnet.mvps.org/code/intri...atrixcheck.htm

LFS
Closed Thread


Similar Visual Basic .NET bytes