|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Visual Basic 2008 express - Index property on labelHello,
I just installed VB 2008 express edition at home and wanted to use an array of labels in my program as I need to show and hide them depending on a random number and this could be done easily using the index property but where is it? Have I missed it in the list or has it gone? Why? If so what do I use instead? The only alternative I can see is now a load of IF THEN statements where all I needed was lblnumber(RandomNumber).show Many thanks in advance Gary "Gazza" <gary_wind***@hotmail.com> wrote in message You're in the wrong newsgroup. This group is for the real Visual Basic (VB6 news:8f77d01e-af64-42ab-a157-ba59d3aab7e5@e10g2000prf.googlegroups.com... > I just installed VB 2008 express edition at home and > wanted to use an array of labels in my program as I > need to show and hide them depending on a random > number and this could be done easily using the > index property but where is it? and previous versions). The application you are using is a different language and should really have been given a different name. As far as I know there are no Control Arrays in the imposter, although I'm sure there will be a way of implementing them in code. VB6 code examples that you might get here will not work in the imposter. You need to post your question to a dotnet group. Mike As an example of what Mike said about them being different languages (and an
answer to part of your question)... There are no control arrays in VB.net (so no control index property). Show quote "Gazza" <gary_wind***@hotmail.com> wrote in message news:8f77d01e-af64-42ab-a157-ba59d3aab7e5@e10g2000prf.googlegroups.com... > Hello, > > I just installed VB 2008 express edition at home and wanted to use an > array of labels in my program as I need to show and hide them > depending on a random number and this could be done easily using the > index property but where is it? Have I missed it in the list or has it > gone? Why? If so what do I use instead? The only alternative I can see > is now a load of IF THEN statements where all I needed was > lblnumber(RandomNumber).show > > Many thanks in advance > > Gary FWIW - Visual Fred control array example
Create some text boxes with the designer (txtQ1, txtQ2, txtQ3, txtQ4) Then in the code behind the form ' Variable declared outside of any sub/function has form level scope Dim txtArray(4) As TextBox Private Sub frmMyForm_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ' This code only gets run once when the form is initally loaded. ' Set Text boxes as a txtArray member txtArray(0) = txtQ1 txtArray(1) = txtQ2 txtArray(2) = txtQ3 txtArray(3) = txtQ4 End Sub Then you can use it anywhere on the form just like real VB Private Sub Kowabonga(ByVal blnTF As Boolean) ' (de)visibleize the Text boxes For i = 0 to 3 txtArray(i).Visible = blnTF Next End Sub Obviously control arrays are far easier to create and use in real VB Ron W. Show quote "BeastFish" <no@spam.com> wrote in message news:fif4o7$a2j$1@aioe.org... > As an example of what Mike said about them being different languages (and > an > answer to part of your question)... > > There are no control arrays in VB.net (so no control index property). > > > > > "Gazza" <gary_wind***@hotmail.com> wrote in message > news:8f77d01e-af64-42ab-a157-ba59d3aab7e5@e10g2000prf.googlegroups.com... >> Hello, >> >> I just installed VB 2008 express edition at home and wanted to use an >> array of labels in my program as I need to show and hide them >> depending on a random number and this could be done easily using the >> index property but where is it? Have I missed it in the list or has it >> gone? Why? If so what do I use instead? The only alternative I can see >> is now a load of IF THEN statements where all I needed was >> lblnumber(RandomNumber).show >> >> Many thanks in advance >> >> Gary > >
Show quote
On 27 Nov, 01:22, "Ron Weiner" <rweineratworksritedotcom> wrote: Hey thanks that's great. So why are these versions different? Why> FWIW - Visual Fred control array example > > Create some text boxes with the designer (txtQ1, txtQ2, txtQ3, txtQ4) > > Then in the code behind the form > > ' Variable declared outside of any sub/function has form level scope > Dim txtArray(4) As TextBox > > Private Sub frmMyForm_Load(ByVal sender As Object, _ > ByVal e As System.EventArgs) Handles MyBase.Load > ' This code only gets run once when the form is initally loaded. > ' Set Text boxes as a txtArray member > txtArray(0) = txtQ1 > txtArray(1) = txtQ2 > txtArray(2) = txtQ3 > txtArray(3) = txtQ4 > End Sub > > Then you can use it anywhere on the form just like real VB > > Private Sub Kowabonga(ByVal blnTF As Boolean) > ' (de)visibleize the Text boxes > For i = 0 to 3 > txtArray(i).Visible = blnTF > Next > End Sub > > Obviously control arrays are far easier to create and use in real VB > > Ron W. > > "BeastFish" <n...@spam.com> wrote in messagenews:fif4o7$a2***@aioe.org... > > As an example of what Mike said about them being different languages (and > > an > > answer to part of your question)... > > > There are no control arrays in VB.net (so no control index property). > > > "Gazza" <gary_wind***@hotmail.com> wrote in message > >news:8f77d01e-af64-42ab-a157-ba59d3aab7e5@e10g2000prf.googlegroups.com... > >> Hello, > > >> I just installed VB 2008 express edition at home and wanted to use an > >> array of labels in my program as I need to show and hide them > >> depending on a random number and this could be done easily using the > >> index property but where is it? Have I missed it in the list or has it > >> gone? Why? If so what do I use instead? The only alternative I can see > >> is now a load of IF THEN statements where all I needed was > >> lblnumber(RandomNumber).show > > >> Many thanks in advance > > >> Gary create something with the same name (nearly) that is not the same? I have not done a great deal of VB in the past but have done a little. I see that an array is define array(4) in express 2008 where in the VB I used before it would have been array(0 to 3). Why make these changes. What is .Net all about then? Is it going to replace the old stuff? As you can tell I am confused???? Many thanks Gary "Gazza" <gary_wind***@hotmail.com> wrote in message Your questions are all good and only MS can tell. They seem to think that news:7d30f850-e98a-4685-8419-01f4c804243d@s19g2000prg.googlegroups.com... > Hey thanks that's great. So why are these versions different? Why > create something with the same name (nearly) that is not the same? I > have not done a great deal of VB in the past but have done a little. I > see that an array is define array(4) in express 2008 where in the VB I > used before it would have been array(0 to 3). Why make these changes. > What is .Net all about then? Is it going to replace the old stuff? As > you can tell I am confused???? they "cleaned up" the language. Too bad they didn't consider whether or not the majority of the users wanted it "cleaned up". A large number of VB users have moved on to Delphi and other non-MS languages since it became crystal clear that MS does not consider anything written in VB to be of any value, nor do they have any consideration for it's users. They trashed the language for no good reason. "Bob Butler" <noway@nospam.ever> wrote in message And of course they were thoroughly dishonest when they called it Visual news:urjo%23RRMIHA.5140@TK2MSFTNGP05.phx.gbl... > A large number of VB users have moved on to Delphi and > other non-MS languages since it became crystal clear that > MS does not consider anything written in VB to be of any > value, nor do they have any consideration for it's users. > They trashed the language for no good reason. Basic when it is clearly NOT Visual Basic! If they had called it Visual Fred or something, and if they had come clean and admitted that they had scrapped Visual Basic, then I might have considered giving it a look, along with the other alternatives such as Delphi. As it stands, Microsoft's blatant dishonesty has caused me not to trust them at all and if I ever do look for something to replace VB6 I will definitely not be looking in their direction! Mike "Gazza" <gary_wind***@hotmail.com> wrote in message Long story short... .Net is basically the result of Microsoft's Java envynews:7d30f850-e98a-4685-8419-01f4c804243d@s19g2000prg.googlegroups.com... > Hey thanks that's great. So why are these versions different? Why > create something with the same name (nearly) that is not the same? I > have not done a great deal of VB in the past but have done a little. I > see that an array is define array(4) in express 2008 where in the VB I > used before it would have been array(0 to 3). Why make these changes. > What is .Net all about then? Is it going to replace the old stuff? As > you can tell I am confused???? (or should we call it Java lust) dating back to the MS/Sun follies years ago, and Microsoft's desire to move personal computing to a web based modal (lease-an-app). Why the difference between the two VBs? Well, when MS decided to .Net-ify the world, they scrapped the ol' VB and rebuilt "VB" from scratch with the old Borland C++ team instead of MS's old VB team. IMO, there was no need to change the syntax and such. Syntax/source code is just the human end of it, what we humans understand and use. If you are the one creating the compiler, it doesn't matter what the source syntax going in is because you are the one making the rules and defining what the source syntax will be... for all it matters, one can make a compiler for LOLCODE (http://lolcode.com) if one desired. So there was no need to change the syntax as much as MS did. It was probably more a result of the different "culture" (C++ guys) and their way of thinking, including prejudices and preconceptions. It's also probable that VB was an afterthought since C# was their "baby". Microsoft should have named the .Net version something like NetBasic or NB or whatever. Would have avoided a lot of the confusion, but it appears they were more concerned with name recognition (obvious since they have since dropped .net from the name). Disclaimer: This shouldn't be a "language war" because as all programmers should know, programming languages are not religions, they are tools... and as with any tool, some are better at certain tasks than others and vice versa. For web services and such, .Net is a understandable choice since that is what it's designed for. But I personally would't use .Net for desktop apps. 8<
> for all it matters, one can make a compiler for LOLCODE (http://lolcode.com)> if one desired. >8 Upon further inspection, it seems there ARE some implementations, includinga dotnet one :-) > So why are these versions different? Why Marketing. It was originally "VB.Net". MS is trying> create something with the same name (nearly) that is not the same? to phase out VB. One way to help do that is to just steal the name for something else. :) > Why make these changes. It's Microsoft's answer to Java.> What is .Net all about then? Is it going to replace the old stuff? It's also a handy way to use the online computing / Web2.0 craze as an excuse to start shutting programmers out of the system files, by giving them a java-style, sandboxed, runtime-dependent, JIT-compiled product to replace the API-using native-compiling languages. A couple of weeks ago Steve Ballmer announced in a shareholders meeting that advertising is the future for Microsoft. That gives some indication of just how far MS has wandered from their original product - a PC software platform. With their eyes on DRM'd entertainment income and online advertising, 3rd party programmers to write useful Desktop software have become unnecessary and intrusive to Microsoft. They'd like to lock down the PC and point developers at making trinkets for their online services. It's a big issue with a lot of facets, actually. And a lot of opinions. > A couple of weeks ago Steve Ballmer announced in a But just think of the possibilities... targeted advertising popping up in> shareholders meeting that advertising is the future for > Microsoft. the inventory control web-centric lease-an-app you've developed! <g> (perhaps I shouldn't joke about that as it might actually be their ambition) |
|||||||||||||||||||||||