8 Replies - 704 Views - Last Post: 08 June 2012 - 04:54 PM Rate Topic: -----

#1 Paco Joe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 07-June 12

How do change my code to make it click sensored?

Posted 08 June 2012 - 07:28 AM

I am making a tic tac toe game and i came to a problem i don't understand...

I am trying to make a click sensor to allow an x or an 0 to appear in a label box but since im new to programming i not sure how you would make it appear <_<
I will post my code of the label to see if someone can help

Thanks!

Dim player1 As Char
        Dim player2 As Char

        If Label1.Text = player1 Then
            Label1.Tag = 1
            Label1.Text = "X"
            Label1.Enabled = False
        ElseIf Label1.Text = player2 Then
            Label1.Tag = 1
            Label1.Text = "0"
            Label1.Enabled = False 



:helpsmilie:

Is This A Good Question/Topic? 0
  • +

Replies To: How do change my code to make it click sensored?

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: How do change my code to make it click sensored?

Posted 08 June 2012 - 08:03 AM

uhm your talking about Label_Click event? You want to make when you click on a label to appear X or O?
Your code dose not make any sense.
By the way your using VB.NET i`ll ask the mods to move it in the right section :)

This post has been edited by raziel_: 08 June 2012 - 08:06 AM

Was This Post Helpful? 1
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,658
  • Joined: 02-June 10

Re: How do change my code to make it click sensored?

Posted 08 June 2012 - 08:33 AM

You're obviously making a Tic-tac-toe game.

Search for tic-tac-toe: There are DOZENS of tic-tac-toe threads that should give you plenty of help. (Pages and pages of TTT in every language)

Are you sure you're doing this in VB6 and not VB.NET? VB6 is pretty much dead except for legacy applications. I can't think of a reason to start learning it now.

I don't mean for this to seem rude, but if you're not familiar enough with the coding language to handle a .Click event then you probably should go back to your text book from the beginning. We can't make up for weeks of lost education in a thread: Its not feesible for us to answer all the ultra-introductory basics for every student in the country. It is incumbent upon the student to cover that material in class, the thousands of "Intro to VB" tutorials and numerous "Learn {language} in 21 days" books.

Attached Image
Was This Post Helpful? 0
  • +
  • -

#4 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 572
  • View blog
  • Posts: 2,986
  • Joined: 19-May 09

Re: How do change my code to make it click sensored?

Posted 08 June 2012 - 08:48 AM

Easiest way to distinguish between player1 and player2 is to remember that they alternate turns.

This post has been edited by BobRodes: 08 June 2012 - 08:50 AM

Was This Post Helpful? 0
  • +
  • -

#5 Paco Joe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 07-June 12

Re: How do change my code to make it click sensored?

Posted 08 June 2012 - 11:53 AM

View Postraziel_, on 08 June 2012 - 08:03 AM, said:

uhm your talking about Label_Click event? You want to make when you click on a label to appear X or O?
Your code dose not make any sense.
By the way your using VB.NET i`ll ask the mods to move it in the right section :)

Haha ya i said im beginning programming with this so bare with me :P
and ya thats what im trying to do so, i am trying to make X appear in the label when you click on it then disable the label click so the next player can't click it.


and btw, i changed the code and removed the tag thing it didn't make anysense to me...
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,658
  • Joined: 02-June 10

Re: How do change my code to make it click sensored?

Posted 08 June 2012 - 11:55 AM

So do you know how to make a handler method for the .Click event?
Select the label
See the yellow lightening bolt in the properties pallet: Click it
Come down to Click - double click in the field to the right.

Do you understand that controls have properties? You see them in the Properties pallet of Visual Studio. All you have to do is change the controls .Enabled property to false.

This post has been edited by tlhIn`toq: 08 June 2012 - 11:56 AM

Was This Post Helpful? 1
  • +
  • -

#7 Paco Joe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 07-June 12

Re: How do change my code to make it click sensored?

Posted 08 June 2012 - 12:06 PM

View PosttlhIn`toq, on 08 June 2012 - 11:55 AM, said:

So do you know how to make a handler method for the .Click event?
Select the label
See the yellow lightening bolt in the properties pallet: Click it
Come down to Click - double click in the field to the right.

Do you understand that controls have properties? You see them in the Properties pallet of Visual Studio. All you have to do is change the controls .Enabled property to false.

Actually i was trying to figure that out. And is the property pallet the thing you see when you do this, [Label1.???] and ya i know how to do the .enabled=flase code but i don't know where to put it so it doesn't screw up the code when i test it.
thats kind of why i experimented with the tags all thought i don't exacly know what they do >.<
Was This Post Helpful? 0
  • +
  • -

#8 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5436
  • View blog
  • Posts: 11,658
  • Joined: 02-June 10

Re: How do change my code to make it click sensored?

Posted 08 June 2012 - 12:29 PM

You are describing the Intellisense contextual menu.

The properties pallet is the pallet marked Properties.

Attached Image

You can open it from here:

Attached Image


I'm sorry how this might come across, but you can't really expect to have a forum teach you all the ultra-basic stuff like how to work your IDE. Microsoft has tons of tutorials for this. There are dozens of YouTube videos. Numerous books. We simply cannot hand-hold every new coder every time they open Visual Studio for the first time. You have to take responsibility for yourself and your introduction to all this. There is just WAY too much info out there on all of this already for us to repeat it in 1,000 threads for every new user.

STOP trying to make this new program from scratch. You lack an understanding of Visual Studio. You lack an understanding of basic .NET language concepts such as events and properties. Pick up a book like "Learn VB.NET in 30 days" and just do the tutorials from cover to cover. That will teach you Visual Studio and give you a basis for the language.

There are three routes people seem to take when learning programming.
  • Just start trying to create programs
  • Start taking apart other programs and try to figure out the language by reverse engineering
  • Follow a guided learning course (school or self-teaching books)


For the life of me I can't figure out why people try 1 & 2.
Sure, 35 years ago the only way I could learn BASIC as a kid was to type programs from a book into a TRS-80 model 1 or Commodore VIC-20, then figure out the commands and syntax by watching the results as the program ran. There simply wasn't any courses for a kid back then.

But now, you can't help but to trip over "Learn {coding language} in 3 weeks" type books and the entire internet is at your disposal for tutorials.

I strongly suggest taking the guided learning approach. Those book authors go in a certain order for a reason: They know what they're doing and they know the best order to learn the materials.

Quote

Where do I start?


You start by learning a coding language FIRST.
Learn to plan before you type.
THEN you start designing software with a purpose.


If this sounds like you

Newbie/Rookie said:

I have a little programming experience but I need to write ...
read this section
Spoiler


Otherwise, you can just jump to the resources here:
Some of the tutorials below are for C# or Java not C, C++, VB.NET [...]. But the conceptual stuff of classes, object oriented design, events etc. are not language specific and should give you enough guidance in theory of program development for you to be able to look-up specific code example in your chosen coding language.



Resources, references and suggestions for new programmers. - Updated Mar 2012
Spoiler

Was This Post Helpful? 3
  • +
  • -

#9 Paco Joe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 07-June 12

Re: How do change my code to make it click sensored?

Posted 08 June 2012 - 04:54 PM

Ok well... thanks for the help i'll keep that in mind ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1