Home All Groups Group Topic Archive Search About
Author
8 Oct 2005 12:50 AM
Arpan
A VB6 application has 2 Forms. The 1st Form has CommandButtons from 0
to 9 & a Label. The Label can be populated with any number by clicking
the appropriate buttons. Apart from these CommandButtons, the 1st Form
has another CommandButton, which when clicked, opens the 2nd Form.

The 2nd Form has a ListBox & a CommandButton. The ListBox gets
populated randomly with 1 or more numbers as options whenever the 2nd
Form opens. Selecting a number from the ListBox & then clicking the
CommandButton in this 2nd Form also populates the Label in the 1st Form
with that number. For e.g. if the user selects 89 in the ListBox &
clicks the CommandButton in the 2nd Form, the Label in the 1st Form
displays 89. Or if the user selects 521 in the ListBox & clicks the
CommandButton in the 2nd Form, the Label in the 1st Form displays 521
so on & so forth. The bottomline is that the Label in the 1st Form can
be populated by both the Forms.

Now what I want is suppose the user selects 89 from the ListBox &
clicks the CommandButton in the 2nd Form, I want the application to
think that the user has first clicked 8 & then 9 in the 1st Form. Or
suppose the user selects 521 from the ListBox & clicks the
CommandButton in the 2nd Form, I want the application to think that the
user has first clicked 5, then 2 & finally 1 in the 1st Form. Is there
any way by which I can implement this?

Thanks,

Arpan

Author
8 Oct 2005 12:56 AM
Bob Butler
"Arpan" <arpan***@hotmail.com> wrote in message
news:1128732623.185853.132740@g47g2000cwa.googlegroups.com
> A VB6 application has 2 Forms. The 1st Form has CommandButtons from 0
> to 9 & a Label.

is that a control array or command1, command2, etc?

Show quoteHide quote
> The Label can be populated with any number by clicking
> the appropriate buttons. Apart from these CommandButtons, the 1st Form
> has another CommandButton, which when clicked, opens the 2nd Form.
>
> The 2nd Form has a ListBox & a CommandButton. The ListBox gets
> populated randomly with 1 or more numbers as options whenever the 2nd
> Form opens. Selecting a number from the ListBox & then clicking the
> CommandButton in this 2nd Form also populates the Label in the 1st
> Form with that number. For e.g. if the user selects 89 in the ListBox
> & clicks the CommandButton in the 2nd Form, the Label in the 1st Form
> displays 89. Or if the user selects 521 in the ListBox & clicks the
> CommandButton in the 2nd Form, the Label in the 1st Form displays 521
> so on & so forth. The bottomline is that the Label in the 1st Form can
> be populated by both the Forms.
>
> Now what I want is suppose the user selects 89 from the ListBox &
> clicks the CommandButton in the 2nd Form, I want the application to
> think that the user has first clicked 8 & then 9 in the 1st Form. Or
> suppose the user selects 521 from the ListBox & clicks the
> CommandButton in the 2nd Form, I want the application to think that
> the user has first clicked 5, then 2 & finally 1 in the 1st Form. Is
> there any way by which I can implement this?

assuming you have individual command buttons on form1 (command1, command2,
etc):

dim sNumber as string
dim x as long
sNumber=list1.text ' get number as string
for x=1 to len(snumber)
  form1.controls("command" & mid$(sNumber,x,1)).Value=True
next

If you have a control array then
form1.commandbuttonname(clng(mid$(sNumber,x,1))).Value=True

--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
8 Oct 2005 3:37 AM
MikeD
"Arpan" <arpan***@hotmail.com> wrote in message
news:1128732623.185853.132740@g47g2000cwa.googlegroups.com...
>A VB6 application has 2 Forms. The 1st Form has CommandButtons from 0
> to 9 & a Label. The Label can be populated with any number by clicking
> the appropriate buttons. Apart from these CommandButtons, the 1st Form
> has another CommandButton, which when clicked, opens the 2nd Form.
>

I get the impression that all of your recent posts/questions are really all
about the same thing (or at least are all related). It just seems to me that
you've got ONE thing you need to accomplish and you're having SEVERAL
problems in doing that....so....you're posting individual messages about
each...and that's just making things more confusing (to you and to us).
Maybe I'm wrong about that. But if I'm right, try consolidating everything
into a single post.

--
Mike
Microsoft MVP Visual Basic
Author
8 Oct 2005 7:17 AM
Arpan
Well, Mike, you are absolutely correct.........I have ONE thing to
accomplish but am encountering SEVERAL problems in doing that.

The reason why I am posting my queries one by one is because if I don't
get a solution for, say, problem1, I am not in a position to proceed
forward. Moreover, consolidating all my queries into a single post will
make the post lengthy & I presume often people tend to avoid going
through mammoth posts, maybe, due to lack of patience or time or both.

Anyways, I will try to consolidate my queries into a single post as far
as possible from now on. Sorry for the incovenience.

Ken, I don't have MSDN installed in my machine. I don't have the CDs (3
in no. I guess) either.

Thanks for your tips & thanks to Mike & Bob as well.

Regards,

Arpan
Author
8 Oct 2005 6:22 AM
Ken Halter
"Arpan" <arpan***@hotmail.com> wrote in message
news:1128732623.185853.132740@g47g2000cwa.googlegroups.com...
>A VB6 application has 2 Forms. The 1st Form has CommandButtons from 0

Do you have MSDN installed? We enjoy answering questions around here but you
should be doing some of the research yourself. The MSDN CDs have several VB
samples that do various "get to know the language" tasks. Sites like
PlanetSourceCode.com have millions of lines of code available for download.
My links page contains several great sites (the list needs to be expanded a
bit, but still)

A couple of general tips...

Click the Tools/Options menu and on the 'Editor' tab, make sure 'Require
Variable Declaration' has a check in its box.
If you'd rather have VB simply turn the code red if there's a syntax error,
instead of showing a message box describing the error (plus turn the code
red), clear the box that says "Auto Syntax Check".

(optional) While that dialog's still open, I might as well suggest clicking
on the 'General' tab, clear "Compile On Demand" and set "Break on Unhandled
Errors"... finally, click on the 'Environment' tab and select 'Prompt to
Save Changes' or 'Save Changes' (I use Prompt)

While running your code, if there's a runtime error, VB displays a dialog
with "Debug" and "Help" buttons. That "Help" button works fairly well <g>
If you come across a keyword you don't know, type it into a code window,
select it and hit F1. Help should open to the page that describes that
keyword.
If you find a control that you're not familiar with, drop one on a form,
select it, hit F1. Help should open to the page that describes that control.
F1 is directly connected to the property browser window, code window, object
browser, etc, etc so, instead of searching help for something, click on it
and hit F1.

Try to take full advantage of intellisense/auto-complete. The list that pops
up as you type contains >everything< that's available to the procedure
you're currently working on. If you find that something is not in that list
when you think it should be, in general, you can't use it without modifying
it's scope or giving VB more information (like the name of an object,
etc.)... if intellisense isn't working at all, there's a syntax error or
missing dependency somewhere in your app. Regardless of what the causes are
that prevent intellisense from working, you'll have to resolve the problems
before you'll be able to run the app.

fwiw, You may not be building a calculator but you seem to want similar
functionality... you might want to go to PlanetSouceCode.com, select the VB
category and search for the word "Calculator". There are literally 100's of
samples.. Heck.... here's the results.

Page 1 of 49 found. Entries 1 - 10 of 485 found
http://www.planetsourcecode.com/vb/scripts/BrowseCategoryOrSearchResults.asp?blnWorldDropDownUsed=TRUE&txtMaxNumberOfEntriesPerPage=10&blnResetAllVariables=TRUE&optSort=Alphabetical&lngWId=1&B1=Quick+Search&txtCriteria=calculator

They're not all relavent so you'll have to weed out the extras... and you
might not want to bother grabbing any samples with under 3 "stars" (unless
they're new)

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
Author
8 Oct 2005 6:44 AM
Ken Halter
PlanetSouceCode? Souce? Time for bed <g>
Author
10 Oct 2005 11:19 AM
DRBarkley
Or a new keyboard--with an "R" key that works!  ;^)

Show quoteHide quote
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:%23m3R2L9yFHA.2880@TK2MSFTNGP12.phx.gbl...
> PlanetSouceCode? Souce? Time for bed <g>
>
>
Author
11 Oct 2005 2:05 PM
Tony Spratt
> Or a new keyboard--with an "R" key that works!  ;^)

FWIW, it's a common poblem...