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

VB.Net - Is there a better way to write this code?

Hello,

I would like to apologize for double posting this question because I posted
this same question in what looks like the VB 6 newgroups and not the .Net
newsgroup...

Here goes:
The code below works but I just keep looking at it and thinking that there
should be some way to compact it. There are 10 ImagePages and the only
difference is their name propertie. i.e. ImagePage1, ImagePage2,
ImagePage3...

My goal is to remove the Select Case statement and replace it with something
like ImagePage&miCnt. (think that is how I did this in Clipper a long, long
time ago.

The problem is that ImagePage is on the left side of the equal symbol as I
am assigning values to the properties of the ImagePage.

If anyone has a solution for this I would be very grateful. Code snippet
below...

Thanks,
Rhek
For miCnt = 1 To 10

msFileName = myDataRow("Image" & miCnt & "URL").ToString()

If Len(msFileName) > 0 Then

msFileName = msApplicationPath & "img\" & msFileName

Select Case miCnt
Case 1
ImagePage1.picImage.Image = Image.FromFile(msFileName)
ImagePage1.lblFileName.Text = msFileName
ImagePage1.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage1.editImageCaption.Text =
myDataRow("Image1Caption").ToString()
Case 2
ImagePage2.picImage.Image = Image.FromFile(msFileName)
ImagePage2.lblFileName.Text = msFileName
ImagePage2.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage2.editImageCaption.Text =
myDataRow("Image2Caption").ToString()
Case 3
ImagePage3.picImage.Image = Image.FromFile(msFileName)
ImagePage3.lblFileName.Text = msFileName
ImagePage3.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage3.editImageCaption.Text =
myDataRow("Image3Caption").ToString()
Case 4
ImagePage4.picImage.Image = Image.FromFile(msFileName)
ImagePage4.lblFileName.Text = msFileName
ImagePage4.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage4.editImageCaption.Text =
myDataRow("Image4Caption").ToString()
Case 5
ImagePage5.picImage.Image = Image.FromFile(msFileName)
ImagePage5.lblFileName.Text = msFileName
ImagePage5.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage5.editImageCaption.Text =
myDataRow("Image5Caption").ToString()
Case 6
ImagePage6.picImage.Image = Image.FromFile(msFileName)
ImagePage6.lblFileName.Text = msFileName
ImagePage6.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage6.editImageCaption.Text =
myDataRow("Image6Caption").ToString()
Case 7
ImagePage7.picImage.Image = Image.FromFile(msFileName)
ImagePage7.lblFileName.Text = msFileName
ImagePage7.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage7.editImageCaption.Text =
myDataRow("Image7Caption").ToString()
Case 8
ImagePage8.picImage.Image = Image.FromFile(msFileName)
ImagePage8.lblFileName.Text = msFileName
ImagePage8.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage8.editImageCaption.Text =
myDataRow("Image8Caption").ToString()
Case 9
ImagePage9.picImage.Image = Image.FromFile(msFileName)
ImagePage9.lblFileName.Text = msFileName
ImagePage9.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage9.editImageCaption.Text =
myDataRow("Image9Caption").ToString()
Case 10
ImagePage10.picImage.Image = Image.FromFile(msFileName)
ImagePage10.lblFileName.Text = msFileName
ImagePage10.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage10.editImageCaption.Text =
myDataRow("Image10Caption").ToString()
End Select

End If

Next


Jul 21 '05 #1
19 1714
Rhek,

And again not the right newsgroup.
In my opinion is the best one for this

microsoft.public.dotnet.languages.vb

To give you an answer in advance with what you can make your question better
for making the question in that newsgroup. In general has dotNet 3 different
windowforms, which have there own used methods (It is better to use the name
Forms because Page stands more for a webform in dotNet, now I had to look at
image.fromfile because that exist not in a Webform).

The form can be
- a standard form which is showed with frm.show
- a MDI child frm which is added to the collection of the MDI parent
- a standard form which is showed with frm.showdialog

In dotNet exist everything from references so you can use in one ore the
other way those references. However the way those forms are instanced is
important to get the right collection.

In VB6 there was one formarray per form, now has every Control, from which
is the Form one a (Child) Control Collection, while the form has even more.

I hope this helps so far?

Cor

I would like to apologize for double posting this question because I posted this same question in what looks like the VB 6 newgroups and not the .Net
newsgroup...

Here goes:
The code below works but I just keep looking at it and thinking that there
should be some way to compact it. There are 10 ImagePages and the only
difference is their name propertie. i.e. ImagePage1, ImagePage2,
ImagePage3...

My goal is to remove the Select Case statement and replace it with something like ImagePage&miCnt. (think that is how I did this in Clipper a long, long time ago.

The problem is that ImagePage is on the left side of the equal symbol as I
am assigning values to the properties of the ImagePage.

If anyone has a solution for this I would be very grateful. Code snippet
below...

Thanks,
Rhek
For miCnt = 1 To 10

msFileName = myDataRow("Image" & miCnt & "URL").ToString()

If Len(msFileName) > 0 Then

msFileName = msApplicationPath & "img\" & msFileName

Select Case miCnt
Case 1
ImagePage1.picImage.Image = Image.FromFile(msFileName)
ImagePage1.lblFileName.Text = msFileName
ImagePage1.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage1.editImageCaption.Text =
myDataRow("Image1Caption").ToString()
Case 2
ImagePage2.picImage.Image = Image.FromFile(msFileName)
ImagePage2.lblFileName.Text = msFileName
ImagePage2.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage2.editImageCaption.Text =
myDataRow("Image2Caption").ToString()
Case 3
ImagePage3.picImage.Image = Image.FromFile(msFileName)
ImagePage3.lblFileName.Text = msFileName
ImagePage3.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage3.editImageCaption.Text =
myDataRow("Image3Caption").ToString()
Case 4
ImagePage4.picImage.Image = Image.FromFile(msFileName)
ImagePage4.lblFileName.Text = msFileName
ImagePage4.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage4.editImageCaption.Text =
myDataRow("Image4Caption").ToString()
Case 5
ImagePage5.picImage.Image = Image.FromFile(msFileName)
ImagePage5.lblFileName.Text = msFileName
ImagePage5.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage5.editImageCaption.Text =
myDataRow("Image5Caption").ToString()
Case 6
ImagePage6.picImage.Image = Image.FromFile(msFileName)
ImagePage6.lblFileName.Text = msFileName
ImagePage6.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage6.editImageCaption.Text =
myDataRow("Image6Caption").ToString()
Case 7
ImagePage7.picImage.Image = Image.FromFile(msFileName)
ImagePage7.lblFileName.Text = msFileName
ImagePage7.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage7.editImageCaption.Text =
myDataRow("Image7Caption").ToString()
Case 8
ImagePage8.picImage.Image = Image.FromFile(msFileName)
ImagePage8.lblFileName.Text = msFileName
ImagePage8.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage8.editImageCaption.Text =
myDataRow("Image8Caption").ToString()
Case 9
ImagePage9.picImage.Image = Image.FromFile(msFileName)
ImagePage9.lblFileName.Text = msFileName
ImagePage9.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage9.editImageCaption.Text =
myDataRow("Image9Caption").ToString()
Case 10
ImagePage10.picImage.Image = Image.FromFile(msFileName)
ImagePage10.lblFileName.Text = msFileName
ImagePage10.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage10.editImageCaption.Text =
myDataRow("Image10Caption").ToString()
End Select

End If

Next

Jul 21 '05 #2
Rhek <Rh**@discussions.microsoft.com> wrote:
I would like to apologize for double posting this question because I posted
this same question in what looks like the VB 6 newgroups and not the .Net
newsgroup...

Here goes:
The code below works but I just keep looking at it and thinking that there
should be some way to compact it. There are 10 ImagePages and the only
difference is their name propertie. i.e. ImagePage1, ImagePage2,
ImagePage3...

My goal is to remove the Select Case statement and replace it with something
like ImagePage&miCnt. (think that is how I did this in Clipper a long, long
time ago.

The problem is that ImagePage is on the left side of the equal symbol as I
am assigning values to the properties of the ImagePage.

If anyone has a solution for this I would be very grateful. Code snippet
below...


Sure, it's very easy: create an array instead, eg ImagePages, and then
use
ImagePages(miCnt).picImage.Image = Image.FromFile(msFileName)

etc.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #3
Cor Ligthert <no**********@planet.nl> wrote:
And again not the right newsgroup.
In my opinion is the best one for this

microsoft.public.dotnet.languages.vb


I'm afraid we disagree again, Cor :)

Using an array of controls (my suggested solution) rather than naming
each one separately isn't a language issue, it's a general design
issue.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4
Jon,
In my opinion is the best one for this

microsoft.public.dotnet.languages.vb


I'm afraid we disagree again, Cor :)


I was preperad on this one, however I noticed that creating a form in C# is
done often in a
slightly other way than VB.Net.

(You can use the C# method in VBNet, however in VBNet is often as well used
the build in Sub Main (as I do), withouth witing it).

When that was not I had only pointed the OP on the VB newsgroup for language
questions.

(By the way I was typing the same solutions as yours and than thought there
can be better one when it are MDI's because than you can use the
childcollection)

Cor
Jul 21 '05 #5
Cor Ligthert <no**********@planet.nl> wrote:
In my opinion is the best one for this

microsoft.public.dotnet.languages.vb
I'm afraid we disagree again, Cor :)


I was preperad on this one, however I noticed that creating a form in C# is
done often in a slightly other way than VB.Net.


Sure - but that doesn't affect *every* question to do with forms.
(You can use the C# method in VBNet, however in VBNet is often as well used
the build in Sub Main (as I do), withouth witing it).
I don't see why that might stop you from using an array of controls...
When that was not I had only pointed the OP on the VB newsgroup for language
questions.
But I still don't see that this is a real language question...
(By the way I was typing the same solutions as yours and than thought there
can be better one when it are MDI's because than you can use the
childcollection)


Well, you could use the Controls collection for non-MDIs. It just
doesn't make much sense to do so, IMO.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #6
Jon,

Telling that in this case the language.vb newsgroup was a better place for
this question was not the only part in my message, reread that, the rest was
completly answered (prepared on your message) about dotNet in a general way.

I handle now the measurement myself that when I can answer a question
without code it is General, with code it is for a Language newsgroup.

(Not saying that you should handle the same method)

:-)

Cor
Jul 21 '05 #7
Jon,

Well, you could use the Controls collection for non-MDIs. It just
doesn't make much sense to do so, IMO.

Are you sure of that, than that would be a difference with VBNet, however I
doubt that, a form is not added to the Control collection normally.
Otherwise there was no reason for a MDIchildcollection.

So the alternative is in my opinion creating (in any way you do that) that
form array to hold the references.

Cor
Jul 21 '05 #8
Cor Ligthert <no**********@planet.nl> wrote:
Well, you could use the Controls collection for non-MDIs. It just
doesn't make much sense to do so, IMO.

Are you sure of that, than that would be a difference with VBNet, however I
doubt that, a form is not added to the Control collection normally.


The *form* isn't added to a controls collection, but I don't see where
there are multiple forms. Maybe the VB posting had more information in
it.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #9
Cor Ligthert <no**********@planet.nl> wrote:
Telling that in this case the language.vb newsgroup was a better place for
this question was not the only part in my message, reread that, the rest was
completly answered (prepared on your message) about dotNet in a general way.
Sure - I was only responding to the part about what the right newsgroup
was though.
I handle now the measurement myself that when I can answer a question
without code it is General, with code it is for a Language newsgroup.

(Not saying that you should handle the same method)


I very strongly disagree with that method of deciding the best
newsgroup. Something can be a perfectly general question but expressed
in a particular language.

Here's an example:

<question>
How do I read a file which contains accented characters? I've tried the
following code, but it doesn't work:

StreamReader sr = new StreamReader ("foo.txt", Encoding.ASCII);
string text = sr.ReadToEnd();
sr.Close();
</question>

The answer to that question has nothing to do with C# - it has
everything to do with how the framework handles encodings, and what an
encoding is. The question can be answered by anyone who knows about
those issues, regardless of what language they use. It's a general
question, not a language-specific one. Why would you want to redirect
such a question to the C# group?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #10
Jon Skeet [C# MVP] <sk***@pobox.com> wrote:
<snip>

For what it's worth, I'm not having this same argument with you again
just for the sake of it. I'd really like other people to chime in and
say what *they'd* like to see on the language groups and what they'd
like to see in .general.

At this stage I should mention that a lot of the "general" questions
might actually be better in .framework - there's a lot of overlap
between the two groups. The lack of charters doesn't help :(

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #11
Jon,

We do not agree about that, and we probably will not, when I point an OP on
the language groups, which I normally always do telling with that that he is
free to go to that, it is something I do and find the right way helping
people, when you find that should be in the framework group, feel free to
tell that, you never will see that I make the decissions for the OP and tell
him to go there.

In this case it was to obvious that this OP was searching for a good group
for VBNet questions, because he had previous post his message in a classic
VB newsgroup he told..

That gives another way of writting about this.

Cor
Jul 21 '05 #12
Cor Ligthert <no**********@planet.nl> wrote:
We do not agree about that, and we probably will not, when I point an OP on
the language groups, which I normally always do telling with that that he is
free to go to that, it is something I do and find the right way helping
people, when you find that should be in the framework group, feel free to
tell that, you never will see that I make the decissions for the OP and tell
him to go there.
Well, you did specifically say "And again not the right newsgroup."
That's quite different from saying that he was "free to go to" the
language group - it's saying that this is the wrong group for the
question.
In this case it was to obvious that this OP was searching for a good group
for VBNet questions, because he had previous post his message in a classic
VB newsgroup he told..

That gives another way of writting about this.


Yes, it's fine to point out the VB.NET group. That doesn't mean that
this isn't a perfectly reasonable group for his question though.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #13
>
That gives another way of writting about this.


Yes, it's fine to point out the VB.NET group. That doesn't mean that
this isn't a perfectly reasonable group for his question though.

Why did you think that I answered the question almost completly, however was
because of the different usual way of creating forms in C# and VBNet in the
opinion that when it should go in code was better in the VBNet newsgroup.

:-)

Cor
Jul 21 '05 #14
On Wed, 8 Sep 2004 10:20:26 +0100, Jon Skeet [C# MVP] wrote:
I'd really like other people to chime in and
say what *they'd* like to see on the language groups and what they'd
like to see in .general.


As I've said in the past, I think it'd be better to see strictly
language-related questions on the language groups. An example of such a
question:

What's the difference between 'string' and 'System.String' in C#?

The answer, of course, would be that there is no real practical difference
-- 'string' is an alias for 'System.String'.

I think general .NET questions belong in .general. All that's left for the
reader to do is define what "general" means in this context. <g>

An example of something I'd feel to be on-topic here would be a post about
the status of .NET in the computing world today.

To be honest, I think that all /framework/ questions belong in .framework,
but I don't really mind seeing them here, partly because I don't feel that
they're *very* off-topic -- which they would be in a language group.
Jul 21 '05 #15
Rhek <Rh**@discussions.microsoft.com> wrote:
Thanks for the reply. Are you talking about a Control Array? If so, I
thought those were discontinued in VB.Net. If not, then I am not sure how an
array would be used to populate the contents of a UserControl (maybe I should
have mentioned that ImagePages is a UserControl).


I was talking about an array of controls - just a normal array, of type
Control().

You may have to write the code yourself instead of using the designer -
or populate the array in your constructor, after the designer code has
created the ten different variables, but that shouldn't matter, as the
controls are just references.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #16
Thanks for the reply again. An array of controls would work nicely. Not
sure how to do it but will dive into the books!

Thanks,
Rhek

"Jon Skeet [C# MVP]" wrote:
Rhek <Rh**@discussions.microsoft.com> wrote:
Thanks for the reply. Are you talking about a Control Array? If so, I
thought those were discontinued in VB.Net. If not, then I am not sure how an
array would be used to populate the contents of a UserControl (maybe I should
have mentioned that ImagePages is a UserControl).


I was talking about an array of controls - just a normal array, of type
Control().

You may have to write the code yourself instead of using the designer -
or populate the array in your constructor, after the designer code has
created the ten different variables, but that shouldn't matter, as the
controls are just references.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #17
Hello again,

Thanks for your help, you pointed me in the right direction. After some
more research I solved the problem as follows (condensed version)...

Dim aImagePage(10) As ImagePage

Private Sub frmInventory_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'Create the ImagePage Control Array
SetControlArray()

End Sub

Sub SetControlArray()
aImagePage(1) = ImagePage1
aImagePage(2) = ImagePage2
aImagePage(3) = ImagePage3
aImagePage(4) = ImagePage4
aImagePage(5) = ImagePage5
aImagePage(6) = ImagePage6
aImagePage(7) = ImagePage7
aImagePage(8) = ImagePage8
aImagePage(9) = ImagePage9
aImagePage(10) = ImagePage10
End Sub

I was then able to change the properties with...

aImagePage(miCnt).picImage.Image = Image.FromFile(msFileName)
aImagePage(miCnt).lblFileName.Text = msFileName
aImagePage(miCnt).picImage.BorderStyle = BorderStyle.FixedSingle
aImagePage(miCnt).editImageCaption.Text = msCaption

Thanks again!
Rhek

"Jon Skeet [C# MVP]" wrote:
Rhek <Rh**@discussions.microsoft.com> wrote:
Thanks for the reply. Are you talking about a Control Array? If so, I
thought those were discontinued in VB.Net. If not, then I am not sure how an
array would be used to populate the contents of a UserControl (maybe I should
have mentioned that ImagePages is a UserControl).


I was talking about an array of controls - just a normal array, of type
Control().

You may have to write the code yourself instead of using the designer -
or populate the array in your constructor, after the designer code has
created the ten different variables, but that shouldn't matter, as the
controls are just references.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #18
Well... I'm a C# developer. I'll do my best at VB.NET code, but I don't
make any promises:

Dim iList as new ArrayList()
Dim curImage as ImagePage ' I don't know what type you are using
here... whatever the type of ImagePage is...
iList.Add(ImagePage1)
iList.Add(ImagePage2)
...
iList.Add(ImagePage10)

For miCnt = 1 to 10
msFileName = myDataRow("Image" & miCnt & "URL").ToString()

If Len(msFileName) > 0 Then

msFileName = msApplicationPath & "img\" & msFileName

curImage = iList(miCnt)
curImage .picImage.Image = Image.FromFile(msFileName)
curImage .lblFileName.Text = msFileName
curImage .picImage.BorderStyle = BorderStyle.FixedSingle
curImage .editImageCaption.Text =
myDataRow("Image1Caption").ToString()
End If
Next

Sorry if there are syntax errors. Like I said, I'm a C# person now. I
moved to C# directly from VB6 about 2 years ago.
HTH,
--- Nick
"Rhek" <Rh**@discussions.microsoft.com> wrote in message
news:96**********************************@microsof t.com...
Hello,

I would like to apologize for double posting this question because I posted this same question in what looks like the VB 6 newgroups and not the .Net
newsgroup...

Here goes:
The code below works but I just keep looking at it and thinking that there
should be some way to compact it. There are 10 ImagePages and the only
difference is their name propertie. i.e. ImagePage1, ImagePage2,
ImagePage3...

My goal is to remove the Select Case statement and replace it with something like ImagePage&miCnt. (think that is how I did this in Clipper a long, long time ago.

The problem is that ImagePage is on the left side of the equal symbol as I
am assigning values to the properties of the ImagePage.

If anyone has a solution for this I would be very grateful. Code snippet
below...

Thanks,
Rhek
For miCnt = 1 To 10

msFileName = myDataRow("Image" & miCnt & "URL").ToString()

If Len(msFileName) > 0 Then

msFileName = msApplicationPath & "img\" & msFileName

Select Case miCnt
Case 1
ImagePage1.picImage.Image = Image.FromFile(msFileName)
ImagePage1.lblFileName.Text = msFileName
ImagePage1.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage1.editImageCaption.Text =
myDataRow("Image1Caption").ToString()
Case 2
ImagePage2.picImage.Image = Image.FromFile(msFileName)
ImagePage2.lblFileName.Text = msFileName
ImagePage2.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage2.editImageCaption.Text =
myDataRow("Image2Caption").ToString()
Case 3
ImagePage3.picImage.Image = Image.FromFile(msFileName)
ImagePage3.lblFileName.Text = msFileName
ImagePage3.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage3.editImageCaption.Text =
myDataRow("Image3Caption").ToString()
Case 4
ImagePage4.picImage.Image = Image.FromFile(msFileName)
ImagePage4.lblFileName.Text = msFileName
ImagePage4.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage4.editImageCaption.Text =
myDataRow("Image4Caption").ToString()
Case 5
ImagePage5.picImage.Image = Image.FromFile(msFileName)
ImagePage5.lblFileName.Text = msFileName
ImagePage5.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage5.editImageCaption.Text =
myDataRow("Image5Caption").ToString()
Case 6
ImagePage6.picImage.Image = Image.FromFile(msFileName)
ImagePage6.lblFileName.Text = msFileName
ImagePage6.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage6.editImageCaption.Text =
myDataRow("Image6Caption").ToString()
Case 7
ImagePage7.picImage.Image = Image.FromFile(msFileName)
ImagePage7.lblFileName.Text = msFileName
ImagePage7.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage7.editImageCaption.Text =
myDataRow("Image7Caption").ToString()
Case 8
ImagePage8.picImage.Image = Image.FromFile(msFileName)
ImagePage8.lblFileName.Text = msFileName
ImagePage8.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage8.editImageCaption.Text =
myDataRow("Image8Caption").ToString()
Case 9
ImagePage9.picImage.Image = Image.FromFile(msFileName)
ImagePage9.lblFileName.Text = msFileName
ImagePage9.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage9.editImageCaption.Text =
myDataRow("Image9Caption").ToString()
Case 10
ImagePage10.picImage.Image = Image.FromFile(msFileName)
ImagePage10.lblFileName.Text = msFileName
ImagePage10.picImage.BorderStyle = BorderStyle.FixedSingle
ImagePage10.editImageCaption.Text =
myDataRow("Image10Caption").ToString()
End Select

End If

Next

Jul 21 '05 #19
Nick,

In my opinion had been the most simple code in this in VBNet.

Private imgpages() as myUserControl

And in the load event
Dim imgpages = New myUserControl() {Imagepage1, Imagepage2 etc}

However that has the same effect as Rhek made, which would not go for real
Forms where I though he was speaking about, because he used the word pages,
this goes only for non top controls.

Cor
Jul 21 '05 #20

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

Similar topics

36
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but...
6
by: Michael | last post by:
Hi, I'm fairly new at Python, and have the following code that works but isn't very concise, is there a better way of writing it?? It seems much more lengthy than python code i have read..... :-)...
18
by: Computer Whizz | last post by:
Hiya... I've a little experience in C++, PHP, and a lot in BASIC... But I wish to move into C++ programming A LOT. Any good compilers/editors/VDI (visual development interface? - can't remember...
8
by: brian.digipimp | last post by:
I turned this in for my programming fundamentals class for our second exam. I am a c++ newb, this is my first class I've taken. I got a good grade on this project I'm just wondering if there is a...
20
by: Fred Hebert | last post by:
I am trying to learn VC.NET and convert some Borland C++ applications. The syntax differences are killing me... Is there an easy way to convert a hex string, entered by the user, to a binary...
43
by: Rob R. Ainscough | last post by:
I realize I'm learning web development and there is a STEEP learning curve, but so far I've had to learn: HTML XML JavaScript ASP.NET using VB.NET ..NET Framework ADO.NET SSL
210
by: Christoph Zwerschke | last post by:
This is probably a FAQ, but I dare to ask it nevertheless since I haven't found a satisfying answer yet: Why isn't there an "ordered dictionary" class at least in the standard list? Time and again...
44
by: Tolga | last post by:
As far as I know, Perl is known as "there are many ways to do something" and Python is known as "there is only one way". Could you please explain this? How is this possible and is it *really* a...
28
by: H J van Rooyen | last post by:
Hi, I want to write a small system that is transaction based. I want to split the GUI front end data entry away from the file handling and record keeping. Now it seems almost trivially easy...
43
Death Slaught
by: Death Slaught | last post by:
I have made a music player in a pop up with JavaScript. It uses frames to write the object into an unseen page. Here's an example of the page the user first sees. <!DOCTYPE html PUBLIC...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
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
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: 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...

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.