Re: student question/ array
From: Jim Carlock (anonymous_at_127.0.0.1)
Date: 04/10/04
- Next message: Randy Birch: "Re: change the classname of my VB6 Application"
- Previous message: Troy Scott: "Re: student question/ array"
- In reply to: Troy Scott: "Re: student question/ array"
- Next in thread: Troy Scott: "Re: student question/ array"
- Reply: Troy Scott: "Re: student question/ array"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 10 Apr 2004 09:28:33 -0400
It sounds like the typical student thing where they leave alot up to
the student to determine the best way to do this. I've seen alot of
instructors work in this manner, and I think they're looking for
creativity.
The way I'd think of it is they want a database. It would help if we
knew why a number would be stored in a combo box and what
that number really represents. Is it the number of persons in a
particular city, state, country? You might want to start here.
Restating things means you understand what is being asked,
and if it's done in front of the class, will show leadership and that
you are willing to step up to the plate and it will help the rest of
the class as well. Don't worry about what they want to teach,
worry about what the problem is. Find out the requirements
that are needed. Alot of times the professor will indicate that
it is up to YOU. But I really don't think that is appropriate,
because things in real life are more defined and the requirements
are more specific, and the end result will be that you will have
accept their abstract problem (and this where your creativity
will come into play, because this is where you redefine what
the problem really is and you create something that goes
beyond what is required, and you'll have an out if the project
you've created doesn't represent what was asked). If needed
restate the problem, put it in writing and get the professor to
sign it.
I'd present the professor with something as follows:
"I understand that you want a database to hold the following
information:
ID, AVGANNUALINCOME, and CITYPOPULATION
and that you will use this information to determine the average
shoe size, which in turn will be used to determine digit size,
which in turn will be used to determine the size of the seat of the
commode, in to prevent kids from falling into commercial
commodes and to prevent these from overflowing into
classrooms."
I've done this in this past with professors that gave quite abstract
problems and it works. Sometimes professors give you a broken
problem and look for you to fix what they've broken. It can be
used in a good manner to help students understand that they need
to ask questions when a problem is presented to them. The
student (or person working on a project) must get a clear
understanding of the project and then take the project from that
point and work a solution.
There really is no need to put a number that represents the number
of persons, in a combobox, and that doesn't make any sense at all.
So ask the professor about what kind of purpose there is for a
number being put into a combobox. It is usually the id that goes
into a combobox, or a limited list of words that are put there,
as in the case of country names, state names, city names, etc.
If you really want to impress the guy, make sure you understand,
the problem. If he is looking for creativity, be creative.
As for the problem, I'd present a form with three fields. Make the
ID field the combobox. Add a fourth field and call it CityName.
You can get to this goal, in several different ways. I'd use an
Access database if you have availability to one. Do you have an
Access Database?
-- Jim Carlock http://www.microcosmotalk.com/ Post replies to the newsgroup. "Troy Scott mindspringcom>" <tigerweld<removebrakets> wrote: no Jim, I need for it to be 14 rows with 3 columns. The first column will hold an ID Number, second column is Annual Income, and third column is Number of Persons. To be honest we have a terrible teacher for a professor. He didn't go over arrays well and the whole class is lost. The user must be able to use a text box for Annual Income and ID Number, the Number of Persons must be a combo box. User must be able to enter all this data for 14 rows, then save it as a file, be able to load the file back into the array and print it. I believe I can figure out the rest if I can just get started on entering the data into an array. Like I said the professor didn't go over this part at all, nor does the text book even mentions it! Thanks, Troy "Jim Carlock" <anonymous@127.0.0.1> wrote in message news:uX35TpeHEHA.2164@TK2MSFTNGP12.phx.gbl... > You will need to set up a loop to loop through the items. > > Dim i As Integer > For i = 1 To 13 > mintIncomeSurvey(i, 1) = Val(Text1.Text) > '...whatever other code you need to set the other stuff up > Next i > > That would put the same value into the first column of the array > you have set up. > > Was there something that we might have overlooked? > > Did you want 13 text boxes? What exactly did you want > to accomplish. Feel free to describe it in real world terms, > ie, you'd like to store name and address information, you'd > like to set up a mortgage payment schedule, etc. > > Alot of times combo boxes are used to select items and > then information is put into other places, ie textboxes, see > real world example of javascript at: > > http://www.microcosmotalk.com/tech/scripts/ > > Select a coutry out of the country combobox there. It's > not VB but the same thing can be done in VB. > > Let us know if that helps. > > -- > Jim Carlock > http://www.microcosmotalk.com/ > Post replies to the newsgroup. > > > "Troy Scott" wrote: > How is this going to work for 14 rows? > > Troy > > "Randy Birch" <rgb_removethis@mvps.org> wrote: > > mintIncomeSurvey(1, 1) = Val(Text1.Text) > > mintIncomeSurvey(1, 2) = Val(Text2.Text) > > mintIncomeSurvey(1, 3) = Val(Text3.Text) > > > > ... or ... > > > > If Combo1.ListIndex > -1 then > > mintIncomeSurvey(1, 1) = Val(Combo1.List(Combo1.ListIndex)) > > end if > > > > ... or, if you're storing the numeric value in the combo item's ItemData > > property ... > > > > If Combo1.ListIndex > -1 then > > mintIncomeSurvey(1, 1) = Combo1.ItemData(Combo1.ListIndex) > > end if > > > > ... then ... > > > > debug.print mintIncomeSurvey(1, 1) > > debug.print mintIncomeSurvey(1, 2) > > debug.print mintIncomeSurvey(1, 3) > > > > to see the values. > > -- > > > > Randy Birch > > MVP Visual Basic > > http://vbnet.mvps.org/ > > Please respond only to the newsgroups so all can benefit. > > > > > > "Troy Scott mindspring.com>" <tigerweld<removebrakets> wrote in message > > news:eTW5gJeHEHA.3584@TK2MSFTNGP09.phx.gbl... > > : Hello, I'm a VB newbie and I am stumped! I'm trying to use two text > boxes > > : and a drop down list to enter data into an array and I don't know how to > > : begin. > > : > > : This is all I have so far. > > : > > : Dim mintIncomeSurvey(1 To 14, 1 To 3) As Integer > > : Dim mintRowIndex As Integer > > : Dim mintColIndex As Integer > > : > > : > > : HELP! > > : > > : Troy > > : > > : > > > > >
- Next message: Randy Birch: "Re: change the classname of my VB6 Application"
- Previous message: Troy Scott: "Re: student question/ array"
- In reply to: Troy Scott: "Re: student question/ array"
- Next in thread: Troy Scott: "Re: student question/ array"
- Reply: Troy Scott: "Re: student question/ array"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|