What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Command Button VB Help

Pages: (2): « First [ 1 ] 2 » Last »
Command Button VB Help
Author: Message:
mwe99
Veteran Member
*****

Avatar

Posts: 2514
Reputation: 67
36 / Male / Flag
Joined: Jul 2004
O.P. Command Button VB Help
Hello, i have to create a game of Mastermind, does anyone know how in Visual Basic

[Image: mm1xo.jpg]


Does anyone know how i can make the colour when clicked, appear in the box below?

Thanks
04-28-2005 05:15 PM
Profile PM Find Quote Report
.blade//
Veteran Member
*****

Avatar

Posts: 2856
Reputation: 39
36 / Male / –
Joined: Jan 2004
RE: Command Button VB Help
I haven't done VB for a while, but this is a fairly simpel way to do it :P

I'm going to call:
The buttons you click by the colours they are.
The choices (at the bottom) "C1", "C2", "C3" and "C4"
The variable "selector" will represent what choice you are on

Put this in the different color buttons.

code:

"C" & selector.backcolor="&H80000007&"
If selector =< 4 then
selector = selector + 1
end if



This post was edited on 04-28-2005 at 05:25 PM by .blade//.
[Image: A%20Pointy%20Rock.jpg]
04-28-2005 05:25 PM
Profile PM Web Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: Command Button VB Help
code:
Dim blank1set, blank2set, blank3set, blank4set As Boolean
Public Sub Blue_click()
If blank1set = True Then
    If blank2set = True Then
        If blank3set = True Then
            blank4.BackColor = &HFF0000
            blank4set = True
        Else
            blank3.BackColor = &HFF0000
            blank3set = True
        End If
    Else
        blank2.BackColor = &HFF0000
        blank2set = True
    End If
Else
    blank1.BackColor = &HFF0000
    blank1set = True
End If

End Sub

something like that?

This post was edited on 04-28-2005 at 05:28 PM by Stigmata.
04-28-2005 05:27 PM
Profile PM Web Find Quote Report
mwe99
Veteran Member
*****

Avatar

Posts: 2514
Reputation: 67
36 / Male / Flag
Joined: Jul 2004
O.P. RE: Command Button VB Help
lol wow am i confused :P

so do i put all the code in the button that is white or the actual coloured button?

the boxes are called:

cmdred
cmdblue
cmdgreen                     MAIN BOXES
cmdyellow
cmdblack
cmdwhite

cmdfinal1
cmdfinal2                     WHITE BOXES
cmdfinal3
cmdfinal4

This post was edited on 04-28-2005 at 05:33 PM by mwe99.
04-28-2005 05:30 PM
Profile PM Find Quote Report
.blade//
Veteran Member
*****

Avatar

Posts: 2856
Reputation: 39
36 / Male / –
Joined: Jan 2004
RE: Command Button VB Help
quote:
Originally posted by mwe99
lol wow am i confused :P

so do i put all the code in the button that is white or the actual coloured button?

the boxes are called:

cmdred
cmdblue
cmdgreen                     MAIN BOXES
cmdyellow
cmdblack
cmdwhite

cmdfinal1
cmdfinal2                     WHITE BOXES
cmdfinal3
cmdfinal4



For my code to work you have to rename "Cmdfinal" 1-4 to "C" 1-4.
[Image: A%20Pointy%20Rock.jpg]
04-28-2005 05:37 PM
Profile PM Web Find Quote Report
mwe99
Veteran Member
*****

Avatar

Posts: 2514
Reputation: 67
36 / Male / Flag
Joined: Jul 2004
O.P. RE: Command Button VB Help
When i do i get an error saying Syntax Error and the

Private Sub cmdred_Click()
"C" & selector.backcolor="&H80000007&"

is highlighted in red


wooo i got it working :D

Cmdfinal1.BackColor = Cmdred.BackColor

This post was edited on 04-28-2005 at 05:43 PM by mwe99.
04-28-2005 05:39 PM
Profile PM Find Quote Report
.blade//
Veteran Member
*****

Avatar

Posts: 2856
Reputation: 39
36 / Male / –
Joined: Jan 2004
RE: Command Button VB Help
Did you define selector?
[Image: A%20Pointy%20Rock.jpg]
04-28-2005 05:42 PM
Profile PM Web Find Quote Report
mwe99
Veteran Member
*****

Avatar

Posts: 2514
Reputation: 67
36 / Male / Flag
Joined: Jul 2004
O.P. RE: Command Button VB Help
Nope i did it the different way... i just need a way to get the buttons when its filled to move on to the next box now gr
04-28-2005 05:45 PM
Profile PM Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: Command Button VB Help
"C" & selector.backcolor="&H80000007&"


the back colour is long not a string

put

"C" & selector.backcolor= &H80000007&

vb will automaticly change it to the right colour value :)
04-28-2005 05:47 PM
Profile PM Web Find Quote Report
mwe99
Veteran Member
*****

Avatar

Posts: 2514
Reputation: 67
36 / Male / Flag
Joined: Jul 2004
O.P. RE: Command Button VB Help
nope still comes up red... here look

it doesn't seem to like the & sign

i have the colour going in the box... i just need something to tell the other colours to go to the next box

so after cmdfinal1 has been filled, automatically make the next colour go to cmdfinal2

This post was edited on 04-28-2005 at 06:02 PM by mwe99.
04-28-2005 05:52 PM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On