Re: Problems with Program on version 6.0
- From: "MikeD" <nobody@xxxxxxxxxxx>
- Date: Mon, 16 Jul 2007 18:42:30 -0400
"stephennpa" <stephennpa@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1625317A-FE19-4103-88FE-A1F49A37898E@xxxxxxxxxxxxxxxx
Am kinda new at this and something I am trying to create isn't working
right
or I have things fouled up. Basically I want this applic to have an
inputbox
come up to take two different numbers which I am calling income and
expense.
I need each box to come up for as many times as the user is entering that
type of data until they hit the cancel button and then the other box comes
up.
You *really* need to rethink that UI design. For the most part, the InputBox
function should be avoided. Repeatedly showing it as you're apparently doing
is a downright nasty thing to do to a user (even if you will be the only
user). Presumably, these numbers must be paired (for every income value,
there must be a corresponding expese value). One thing you could do is just
put 2 textboxes on your form, one for income and one for expense. The user
types a value in each and clicks a command button. When the button is
clicked, you store those values (either save to a file or perhaps just to
memory) and clear the textboxes for the user to enter additional pairs of
values. When all data is input, the user clicks ANOTHER button to perform
whatever action needs done with all the entered data. MUCH cleaner than
repeatedly popping up InputBoxes.
On the main form I am wanting the income and expense totals to show in
two different areas and depending on which is more, an amount showing in
one
of two areas I have called profit or loss. Might have to use if...then
else...looping to get this working right and kinda confused about
declaring
variables as far as dim statements...sng as single/int as integer and all
that. Any help is appreciated
Well, since they are most likely money amounts, use the Currency data type.
Also, seems like you should use an array, actually 2. One array for all the
income values and another array for the expense values. You could either sum
the values on-the-fly as the user enters them, or if added to an array(s),
you'd loop through the array(s) to sum them. Just one reason to use an
array(s) would be so you can redisplay the data the user entered and allow
the values to be changed without the user having to re-enter everything all
over again. There's also other means you could use to store the values
besides arrays. For example, you could have 2 ComboBoxes (one for income and
another for expense) and when the user clicks the command button (per above
recommendation), you add the values to the corresponding comboboxes. In any
case, once summed, then yes, you'd just use an If..Then to compare the total
income to the total expense (IOW, the summed values of each of these).
Best thing you can do is write the code and then if it "doesn't work",
explain in detail what's not working (provide error messages, the results
you're getting, etc, etc. DON'T just tell us "it doesn't work" because that
tells us nothing). Even if it "does work", but you think maybe you're not
doing things the best way, post your code and we'll critique it for you.
<g>
The point is that you need to at least TRY on your own first. The absolutely
best way to learn is by doing, even if you do it "wrong".
--
Mike
Microsoft MVP Visual Basic
.
- Prev by Date: Re: Singles to Doubles
- Next by Date: Re: Singles to Doubles
- Previous by thread: vb6 WebBrowser control on Vista
- Next by thread: What does these doevents do?
- Index(es):