Question about my array setup

Page 1 of 1

10 Replies - 1360 Views - Last Post: 12 November 2012 - 01:47 PM Rate Topic: -----

#1 RYKIN  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 24-October 12

Question about my array setup

Posted 12 November 2012 - 01:31 AM

This is my array:
aryProv(0).prov = "NOVA SCOTIA"

What the program does:
2 functions, if the user enters in a province, such as "NOVA SCOTIA", the program generates the abbreviation "NS". If they enter in "NS" the outcome is "NOVA SCOTIA".

What I want the program to do:
I want it to recognize multiple array outputs. See how I have "NOVA SCOTIA" in all caps? I want it so I can enter in like "Nova Scotia" or "nova scotia". This way it's not case sensitive. The program currently works fine but I can't make the array actually equal more than just the "NOVA SCOTIA".

I tried:
aryProv(0).prov = "NOVA SCOTIA" or "Nova Scotia" or "nova scotia" but these don't work. I also tried:

aryProv(0).prov = "NOVA SCOTIA", "Nova Scotia", "nova scotia"

But neither of these worked.

Can anyone help me out on this one? Aside from this minor detail, everything is running smoothly.

Thanks in advance for any help.

Mike

Is This A Good Question/Topic? 0
  • +

Replies To: Question about my array setup

#2 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5315
  • View blog
  • Posts: 11,371
  • Joined: 02-June 10

Re: Question about my array setup

Posted 12 November 2012 - 08:28 AM

Stop. Stop. Stop.

Quote

This is my array:
aryProv(0).prov = "NOVA SCOTIA"

To be clear that is not an array. That is one element of an array.
aryProv might be an array. But aryProv(0) is first element of that array. It can only hold one value.

The idea that you are going to make numerous arrays for every case combination is just plain silly.

and it seems obvious that you haven't so much as read any textbook's chapter on arrays or you wouldn't be trying to set a single element to several values.

VB6 might be 10 years dead and something that nobody would use to build a new program today, but I'm sure it might have some commands for dealing with case. For example

string temp = "NOVA SCOTIA".ToLower();// In C# this would set temp to "nova scotia"


Its common to do this sort of things before comparrisons

if (UserInput.ToLower() == "nova scotia")
{ 
    // Then do this
}


My suggestion is you stop trying to build this application. You're clueless about the language you are working with or the concept of array's that you're trying to use. Pick up a book on VB.6 (Try the public library for something this old) and just work it cover to cover.

Personally though I think it would be a much better use of your time to work on a language people use in THIS century. I mean, its all equally new to you. You can spend 5,000 hours learning VB6 and qualify for 3 jobs a month updating legacy applications or you can spend the same 5,000 hours on a modern language and qualify for 100 times as many jobs.

This post has been edited by tlhIn`toq: 12 November 2012 - 08:30 AM

Was This Post Helpful? 0
  • +
  • -

#3 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,755
  • Joined: 26-March 09

Re: Question about my array setup

Posted 12 November 2012 - 08:48 AM

As a follow on, the equivalent in VB6 to ToUpper is UCASE$ or LCASE$ for ToLower.

How are you populating your "array" and what is the datatype of this "array"??

The fact that your referencing a property of "prov" suggests its some user defined type or a class?

Show us some more code on this, as what you've posted doesn't help and as mentioned previously, makes no sense.

This post has been edited by maj3091: 12 November 2012 - 08:48 AM

Was This Post Helpful? 1
  • +
  • -

#4 RYKIN  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 24-October 12

Re: Question about my array setup

Posted 12 November 2012 - 01:02 PM

View PosttlhIn`toq, on 12 November 2012 - 08:28 AM, said:

Stop. Stop. Stop.

Quote

This is my array:
aryProv(0).prov = "NOVA SCOTIA"

To be clear that is not an array. That is one element of an array.
aryProv might be an array. But aryProv(0) is first element of that array. It can only hold one value.

The idea that you are going to make numerous arrays for every case combination is just plain silly.

and it seems obvious that you haven't so much as read any textbook's chapter on arrays or you wouldn't be trying to set a single element to several values.

VB6 might be 10 years dead and something that nobody would use to build a new program today, but I'm sure it might have some commands for dealing with case. For example

string temp = "NOVA SCOTIA".ToLower();// In C# this would set temp to "nova scotia"


Its common to do this sort of things before comparrisons

if (UserInput.ToLower() == "nova scotia")
{ 
    // Then do this
}


My suggestion is you stop trying to build this application. You're clueless about the language you are working with or the concept of array's that you're trying to use. Pick up a book on VB.6 (Try the public library for something this old) and just work it cover to cover.

Personally though I think it would be a much better use of your time to work on a language people use in THIS century. I mean, its all equally new to you. You can spend 5,000 hours learning VB6 and qualify for 3 jobs a month updating legacy applications or you can spend the same 5,000 hours on a modern language and qualify for 100 times as many jobs.


I've read this a few times now and can't figure out why you're so angry towards it. I'm clearly new to it, so saying stuff like "you're clueless" really is not necessary. If you're that insulted by a post on here, then don't reply.

I don't understand why people have to be so degrading over text. I admit I'm not a professional at this but I'm wanting to learn, however.
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil  Icon User is online

  • Head MFIC
  • member icon

Reputation: 5069
  • View blog
  • Posts: 26,456
  • Joined: 10-May 07

Re: Question about my array setup

Posted 12 November 2012 - 01:07 PM

View PostRYKIN, on 12 November 2012 - 03:02 PM, said:

I'm clearly new to it, so saying stuff like "you're clueless" really is not necessary. If you're that insulted by a post on here, then don't reply.

You are taking it out of context.

Quote

You're clueless about the language you are working with or the concept of array's that you're trying to use. Pick up a book on VB.6 (Try the public library for something this old) and just work it cover to cover.


This statement is of fact, & he's trying to point you into the right direction rather than letting you learn incorrectly. Fundamentals of programming & development are necessary.
Was This Post Helpful? 1
  • +
  • -

#6 RYKIN  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 24-October 12

Re: Question about my array setup

Posted 12 November 2012 - 01:09 PM

I'm done with this site. People like that guy ruin it for me.

The point is to come here and ask questions. I didn't come here looking for answers. See ya's. Thanks for the help.
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil  Icon User is online

  • Head MFIC
  • member icon

Reputation: 5069
  • View blog
  • Posts: 26,456
  • Joined: 10-May 07

Re: Question about my array setup

Posted 12 November 2012 - 01:12 PM

View PostRYKIN, on 12 November 2012 - 03:09 PM, said:

The point is to come here and ask questions. I didn't come here looking for answers.

Not sure how the 2nd item isn't the obvious result of the first. *shrug*

Plus, why do you have two accounts? The two accounts have been merged.
Was This Post Helpful? 1
  • +
  • -

#8 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5315
  • View blog
  • Posts: 11,371
  • Joined: 02-June 10

Re: Question about my array setup

Posted 12 November 2012 - 01:34 PM

Please don't think I'm angry. I'm not. One has to be emotionally invested in other person to be angry. I don't know you that well.

There is a difference between coming to a site looking for help with a specific issue and coming to a site without having done ANY basic preparation like working through the simplest of "Learn VB in 30 day" type books, and expecting everyone to hand-hold you through the ultra-basics.

You have to take some responsibility for yourself and your education. This is not a paid on-line university you've come to. This is an all volunteer site where senior coding professionals choose to mentor up and coming coding professionals they exhibit a decent work ethic.

Most of the people I talk to here feel there is also an obligation to help our industry at large. Those rookies that show they have what it takes will get LOTS of our time and patience. Those that are lazy, aren't willing to put in any effort on their own, won't put in any trial and error... basically those that show they would be someone we wouldn't want to see in the cubical next to use because they would be constantly ask "Show me how to do my job"... are people we don't waste much time on.

You show us some effort, we'll give you some effort. Like most places in life.

If you want to actually learn we're here to help.


My standard beginner resources post

Spoiler

Was This Post Helpful? 0
  • +
  • -

#9 RYKIN  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 24-October 12

Re: Question about my array setup

Posted 12 November 2012 - 01:39 PM

My problem isn't with that. I don't need a general common sense life lesson.

Furthermore, my problem is with someone saying I'm clueless. Then telling me to stop writing an application that works, minus the small part that doesn't.

What I came here for was a hint/nudge/help. I never asked for anyone to hand-hold me through it. I think you're jumping to conclusions a bit too fast here. I'd rather someone nudge me in the right direction instead of flat out telling me how to write a specific piece of code I don't understand.

To add; you knew it was an element, and I said the program works, so clearly I'm not here asking for you to write it. I stated above that the upper/lower cases don't work and it's defaulting to upper case as I have it set to DO that in the properties.

Jumping ahead and assuming doesn't get you anyway in life, either.
Was This Post Helpful? 0
  • +
  • -

#10 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10188
  • View blog
  • Posts: 37,629
  • Joined: 27-December 08

Re: Question about my array setup

Posted 12 November 2012 - 01:42 PM

Let's keep the discussion technical and on topic rather than about disputes with other members, please.
Was This Post Helpful? 0
  • +
  • -

#11 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2216
  • View blog
  • Posts: 9,352
  • Joined: 29-May 08

Re: Question about my array setup

Posted 12 November 2012 - 01:47 PM

RYKIN: Let's start of with a fresh new question post.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1