Command Button VB Help - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Command Button VB Help (/showthread.php?tid=43807) Command Button VB Help by mwe99 on 04-28-2005 at 05:15 PM
Hello, i have to create a game of Mastermind, does anyone know how in Visual Basic RE: Command Button VB Help by .blade// on 04-28-2005 at 05:25 PM
I haven't done VB for a while, but this is a fairly simpel way to do it code: RE: Command Button VB Help by Stigmata on 04-28-2005 at 05:27 PM
code: something like that? RE: Command Button VB Help by mwe99 on 04-28-2005 at 05:30 PM
lol wow am i confused RE: Command Button VB Help by .blade// on 04-28-2005 at 05:37 PM
quote: For my code to work you have to rename "Cmdfinal" 1-4 to "C" 1-4. RE: Command Button VB Help by mwe99 on 04-28-2005 at 05:39 PM
When i do i get an error saying Syntax Error and the RE: Command Button VB Help by .blade// on 04-28-2005 at 05:42 PM Did you define selector? RE: Command Button VB Help by mwe99 on 04-28-2005 at 05:45 PM 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 RE: Command Button VB Help by Stigmata on 04-28-2005 at 05:47 PM
"C" & selector.backcolor="&H80000007&" RE: Command Button VB Help by mwe99 on 04-28-2005 at 05:52 PM
nope still comes up red... here look RE: Command Button VB Help by .blade// on 04-28-2005 at 06:03 PM
quote: Well try this code: (If your version of VB recognises "ME" - otherwise replace "me" with the box name) code: RE: Command Button VB Help by mwe99 on 04-28-2005 at 06:09 PM Whats the selector then? the cmdfinal1 ? RE: Command Button VB Help by .blade// on 04-28-2005 at 06:12 PM
quote: I told you before - selector is a variable with a number which is between 1 and 4. Every time a colour is picked, the number goes up - so that C & selector always gives you the right selection. RE: Command Button VB Help by Millenium_edition on 04-28-2005 at 06:15 PM if you would have used arrays of buttons, you'd only have to write one procedure and it would have been much easier. RE: Command Button VB Help by segosa on 04-28-2005 at 09:08 PM
code: I really can't see how that's meant to work. It's not logical, and it obviously doesn't work as mwe has said three times it highlights it in red. What is ""C" & selector.backcolor "? You can't dynamically concatenate a backcolor onto the end of a string and set it to something. You make no sense. RE: Command Button VB Help by CookieRevised on 04-29-2005 at 08:41 AM
quote:no wonder First of all disregard everything Blade has said... sorry Blade, but yours make no sense at all. As Segosa said, that isn't even logic programming code. quote:indeed. And this is the way to go for something like this... code:see attached zip for full example code RE: Command Button VB Help by mwe99 on 04-29-2005 at 07:09 PM
It still makes the code red RE: Command Button VB Help by CookieRevised on 04-30-2005 at 02:20 AM
quote:We said to disregard Blade's code as that isn't even logical programming code and will never work in any programming language. quote:1) The code you're working in is "VBA" (aka "Visual Basic for Applications"). This is not the same as "Visual Basic" which we were all talking about (although many things are similar)! 2) Look at my code which I attached in the zipfile in my previous post and the related comments... The thing you need to change is to add the code for the colorbutton to each individual color button on your form, as VBA doesn't support array's of controls, the rest of the principle is just the same. EDIT: I've edited your Excel sheet with working code for that particular form (see attachment in this post). |