From: J.B. Moreno on
<wrong.address.1(a)gmail.com> wrote:

> On 27 syys, 03:59, "J.B. Moreno" <pl...(a)newsreaders.com> wrote:
> > <wrong.addres...(a)gmail.com> wrote:
> > > VB Express 2008 converts VB6 code with control arrays fine and it
> > > seems to work, but I cannot figure out what exactly it is doing. There
> > > is some VB6.Compatibility functionality. I have plenty of arrays of
> > > text boxes and labels on several forms.
> >
> > It's doing the same thing that VB6 was doing, it's just more upfront
> > about it it -- it's creating a series of objects and adding them to a
> > array.
>
> Where do I find that code?

It's in the *.Designer.vb file, I usually click on the form's class and
find all references and then click on the partial class to get to
*.Designer.vb file. But really, in both VB6 and VB.Net, you generally
want to work with the designer, not hand code things.

> > Unlike with VB6, these objects are directly addressable, so if you're
> > using constants for the array index you should just skip the array and
> > go directly to the back end object -- it'll have a name (that you can
> > change to be more re-memorable) and doing that makes your code more
> > understandable.
>
> Probably not because I have lots of arrays for mathematical or
> engineering calculations and sometimes some of those arrays have to be
> displayed, or the user.has to be allowed to feed in the values of some
> of those arrays.

OK.

> There are also a couple of matrices which need to be shown, but
> instead of using the grid, I have used a textbox array for years, with
> textbox locations rearranged every time.
>
> >
> > You might also look at iterating over the controls in containers
> > (panels, tabs and so forth), this might be related to what you're doing
> > with control arrays.
>
> What is this for?

All controls have a Controls property that is a collection of controls
within that control. So, a group box is a control that defines an area
on the form that contains other controls, and it's easy to step through
and address the controls in that container. If you move the control to
another container then it's no longer in the collection, but if you
move the container all of it's controls remain within in the container.

It's basically a more powerful way of doing control arrays. But it is
slightly different, so an automatic upgrade won't be using this method.

--
J.B. Moreno
From: J.B. Moreno on
<wrong.address.1(a)gmail.com> wrote:

> On 27 syys, 01:53, "Martin H." <hk...(a)gmx.net> wrote:
> > Hello C,
> >
> > > Another problem is that I cannot address Label31 on each Form by a
> > > subroutine in a module by FormN.Label31. What is good way around this?
> >
> > you might want to check the modifier for that label.
> > If it is set to Private, you can't access it from outside.
> > the form.
> >
> > Best regards,
> >
> > Martin H.
>
> Its modifier is Public. Automatic conversion has done this.
>
> Here is that subroutine:
>
> Sub formsize(ByRef FormN As System.Windows.Forms.Form)

Two things, you don't need the ByRef and although it's not hurting
anything in this particular instance, it should only be used when
necessary. ByRef parameters and ado recordsets can be a problem.
Secondly, the parameter is of type Form and Label30 and Label31 are
unique to your particular form class. This code will work (provided
you are allowing late binding), but if at all possible should be
changed to take the specific type of form that you are using.

> 'UPGRADE_ISSUE: Form property FormN.ScaleWidth was not upgraded.
> ' FormN.ScaleWidth = 11940
> FormN.Height = VB6.TwipsToPixelsY(8500)
> FormN.Width = VB6.TwipsToPixelsX(12060)
> FormN.BackColor = System.Drawing.ColorTranslator.FromOle(RGB(rrr,
> ggg, bbb))
> 'UPGRADE_ISSUE: Form property FormN.DrawWidth was not upgraded.
> ' FormN.DrawWidth = 1
> 'UPGRADE_ISSUE: Control Label30 could not be resolved because it was within the generic namespace Form.
> ' FormN.Label30.Width = 8000
> 'UPGRADE_ISSUE: Control Label31 could not be resolved because []
> ' FormN.Label31.Width = 8000
> 'UPGRADE_ISSUE: Control Label30 could not be resolved because []
> ' FormN.Label30 = TitleS
> 'UPGRADE_ISSUE: Control Label31 could not be resolved because []
> ' FormN.Label31 = SubtitleS
> 'UPGRADE_ISSUE: Control Label30 could not be resolved because []
> ' FormN.Label30.ForeColor = RGB(r3, g3, b3)
> 'UPGRADE_ISSUE: Control Label31 could not be resolved because []
> ' FormN.Label31.ForeColor = RGB(255, 255, 255)
> If rrr = 255 And ggg = 255 And bbb = 255 Then
> 'UPGRADE_ISSUE: Control Label31 could not be resolved
> ' FormN.Label31.ForeColor = RGB(0, 0, 0)
> End If
>
> End Sub

On a somewhat different note -- do you see how I edited the upgrade
issues so that the "click" on comment is gone? I'd recommend that you
do this for any upgraded code that you are posting questions about, as
it makes reading the code MUCH easier and we can probably figure it out
without referring to it. If you want to leave in one instance, that
wouldn't be so much of a problem, but with the wrapping, the code just
gets too busy...

--
J.B. Moreno
From: C on
On 27 syys, 19:45, "J.B. Moreno" <pl...(a)newsreaders.com> wrote:
> <wrong.addres...(a)gmail.com> wrote:
> > On 27 syys, 03:59, "J.B. Moreno" <pl...(a)newsreaders.com> wrote:
> > > <wrong.addres...(a)gmail.com> wrote:
> > > >VBExpress 2008 converts VB6 code withcontrolarrays fine and it
> > > > seems to work, but I cannot figure out what exactly it is doing. There
> > > > is some VB6.Compatibility functionality. I have plenty of arrays of
> > > > text boxes and labels on several forms.
>
> > > It's doing the same thing that VB6 was doing, it's just more upfront
> > > about it it -- it's creating a series of objects and adding them to a
> > >array.
>
> > Where do I find that code?
>
> It's in the *.Designer.vbfile, I usually click on the form's class and
> find all references and then click on the partial class to get to
> *.Designer.vbfile.  But really, in both VB6 andVB.Net, you generally
> want to work with the designer, not hand code things.
>
> > > Unlike with VB6, these objects are directly addressable, so if you're
> > > using constants for thearrayindex you should just skip thearrayand
> > > go directly to the back end object -- it'll have a name (that you can
> > > change to be more re-memorable) and doing that makes your code more
> > > understandable.
>
> > Probably not because I have lots of arrays for mathematical or
> > engineering calculations and sometimes some of those arrays have to be
> > displayed, or the user.has to be allowed to feed in the values of some
> > of those arrays.
>
> OK.
>
> > There are also a couple of matrices which need to be shown, but
> > instead of using the grid, I have used a textboxarrayfor years, with
> > textbox locations rearranged every time.
>
> > > You might also look at iterating over the controls in containers
> > > (panels, tabs and so forth), this might be related to what you're doing
> > > withcontrolarrays.
>
> > What is this for?
>
> All controls have a Controls property that is a collection of controls
> within thatcontrol.  So, a group box is acontrolthat defines an area
> on the form that contains other controls, and it's easy to step through
> and address the controls in that container.  If you move thecontrolto
> another container then it's no longer in the collection, but if you
> move the container all of it's controls remain within in the container.
>
> It's basically a more powerful way of doingcontrolarrays.  But it is
> slightly different, so an automatic upgrade won't be using this method.
>
> --
> J.B. Moreno

I found the *.designer.vb where this stuff is.

Me._Text2_3 = New System.Windows.Forms.TextBox
Me._Text2_2 = New System.Windows.Forms.TextBox
Me._Text2_1 = New System.Windows.Forms.TextBox
Me._Text2_0 = New System.Windows.Forms.TextBox
Me._Text1_15 = New System.Windows.Forms.TextBox
Me._Text1_14 = New System.Windows.Forms.TextBox
Me._Text1_13 = New System.Windows.Forms.TextBox
Me._Text1_12 = New System.Windows.Forms.TextBox

followed by

Me.Text2.SetIndex(Me._Text2_12, CType(12, Short))
etc.

Fortunately this has been done by the conversion wizard. If I have to
do this myself, what is the right way of doing it? For example, my
Form2 needs 16 textboxes called Text1, 16 of Text2, 16 Label1 and 16
Label2. Then there are some commands for calculations. How should I do
this? In VB6, it could be done nicely and cleanly.
From: J.B. Moreno on
<wrong.address.1(a)gmail.com> wrote:

> "J.B. Moreno" <pl...(a)newsreaders.com> wrote:
-snip-
> >
> > It's basically a more powerful way of doingcontrolarrays. �But it is
> > slightly different, so an automatic upgrade won't be using this method.
>
> I found the *.designer.vb where this stuff is.

Like I said in the part I snipped, you don't want to go editing the
designer file anymore than you want to be opening a frm file in a text
editor and editing it -- it's possible, but absent specific reasons and
experience, not a good idea.

> Me._Text2_3 = New System.Windows.Forms.TextBox
> Me._Text2_2 = New System.Windows.Forms.TextBox
> Me._Text2_1 = New System.Windows.Forms.TextBox
> Me._Text2_0 = New System.Windows.Forms.TextBox
> Me._Text1_15 = New System.Windows.Forms.TextBox
> Me._Text1_14 = New System.Windows.Forms.TextBox
> Me._Text1_13 = New System.Windows.Forms.TextBox
> Me._Text1_12 = New System.Windows.Forms.TextBox
>
> followed by
>
> Me.Text2.SetIndex(Me._Text2_12, CType(12, Short))
> etc.
>
> Fortunately this has been done by the conversion wizard. If I have to
> do this myself, what is the right way of doing it? For example, my
> Form2 needs 16 textboxes called Text1, 16 of Text2, 16 Label1 and 16
> Label2. Then there are some commands for calculations. How should I do
> this? In VB6, it could be done nicely and cleanly.

You'd do it in the designer -- dragging the TextBox from the ToolBox to
the appropriate place on your form. Pretty much like you did in VB6
originally.

BTW - I'd recommend changing the names (in the designer) of the various
controls to something appropriate.

--
J.B. Moreno
From: C on
On 4 loka, 23:58, "J.B. Moreno" <pl...(a)newsreaders.com> wrote:
> <wrong.addres...(a)gmail.com> wrote:
> > "J.B. Moreno" <pl...(a)newsreaders.com> wrote:
> -snip-
>
> > > It's basically a more powerful way of doingcontrolarrays.  But it is
> > > slightly different, so an automatic upgrade won't be using this method.
>
> > I found the *.designer.vb where this stuff is.
>
> Like I said in the part I snipped, you don't want to go editing the
> designer file anymore than you want to be opening a frm file in a text
> editor and editing it -- it's possible, but absent specific reasons and
> experience, not a good idea.
>
>
>
>
>
> >         Me._Text2_3 = New System.Windows.Forms.TextBox
> >         Me._Text2_2 = New System.Windows.Forms.TextBox
> >         Me._Text2_1 = New System.Windows.Forms.TextBox
> >         Me._Text2_0 = New System.Windows.Forms.TextBox
> >         Me._Text1_15 = New System.Windows.Forms.TextBox
> >         Me._Text1_14 = New System.Windows.Forms.TextBox
> >         Me._Text1_13 = New System.Windows.Forms.TextBox
> >         Me._Text1_12 = New System.Windows.Forms.TextBox
>
> > followed by
>
> >         Me.Text2.SetIndex(Me._Text2_12, CType(12, Short))
> > etc.
>
> > Fortunately this has been done by the conversion wizard. If I have to
> > do this myself, what is the right way of doing it? For example, my
> > Form2 needs 16 textboxes called Text1, 16 of Text2, 16 Label1 and 16
> > Label2. Then there are some commands for calculations. How should I do
> > this? In VB6, it could be done nicely and cleanly.
>
> You'd do it in the designer -- dragging the TextBox from the ToolBox to
> the appropriate place on your form.  Pretty much like you did in VB6
> originally.

Yes, I can drag the textbox and create 32 of them but how do I get
them into an array without messing with the designer.vb?

>
> BTW - I'd recommend changing the names (in the designer) of the various
> controls to something appropriate.

You mean txtVolume and txtDensity instead of Text1 and Text2?

>
> --
> J.B. Moreno- Piilota siteerattu teksti -
>
> - Näytä siteerattu teksti -