Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Create a button that will open another page

visual studio 2012 windows 8 button

  • Please log in to reply
30 replies to this topic

#13 Zer033x

Zer033x

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 50 posts
  • Programming Language:C++, C#, Lua
  • Learning:C++, C#, JavaScript, Lua, Others

Posted 14 August 2012 - 06:16 PM

You need to understand basics of objects. When you see something like

Opções myWindow = new Opções();

It means you're creating a "myWindow" variable that is of the type Opções. Once you have the variable created you can then use it to call any functions that are defined for that class type (Opções), in thise case "Show()" by using the dot operator. To make a game you'll need to understand stuff like this, games are very complex.
  • 0

#14 Tonchi

Tonchi

    Helping the world with programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1249 posts
  • Location:Zagreb
  • Programming Language:C#, Others
  • Learning:C, C++, Python, JavaScript, Transact-SQL, Assembly

Posted 15 August 2012 - 01:32 AM

You need to understand basics of objects. When you see something like

Opções myWindow = new Opções();

It means you're creating a "myWindow" variable that is of the type Opções. Once you have the variable created you can then use it to call any functions that are defined for that class type (Opções), in thise case "Show()" by using the dot operator. To make a game you'll need to understand stuff like this, games are very complex.


myWindows here is not a variable. It is object that holds the reference on Opções class.
It's like you have created a new class that contains the same code as Opções. Laic, you could say it is something like inheritance.

If he want to make a game, he will first need to learn OOP in C#. All concepts + graphic in C#. That is not something you can learn in few days.
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#15 obiwans

obiwans

    CC Lurker

  • New Member
  • Pip
  • 9 posts
  • Programming Language:(Visual) Basic
  • Learning:C, C++, C#, Visual Basic .NET, Pascal

Posted 15 August 2012 - 10:36 AM

I'm working on a stage. And they asked me to pass one Iphone game for windows 8,(without even see the code) I know the basics of what was taught in school. But it is not enough. They only tell me to search the internet ..
I will test that code tomorow . Thanks for the help i hope that will work.

If he want to make a game, he will first need to learn OOP in C#. All concepts + graphic in C#. That is not something you can learn in few days.


I just need to make the menu and basic . The game is for 2-3 old kids . Not hard even for me .. (I am 17 years old . Still need college )
My only real problem is that i work for 3 years learning c# c++ and visual basic . with windows forms .
And windows 8 - visual studio 2012 dont have windows forms only Metro style .
  • 0

#16 Tonchi

Tonchi

    Helping the world with programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1249 posts
  • Location:Zagreb
  • Programming Language:C#, Others
  • Learning:C, C++, Python, JavaScript, Transact-SQL, Assembly

Posted 15 August 2012 - 10:49 AM

I am not aware of VS 2012 but since you can use old desktop on Win8 I bet you can work on desktop applications. Maybe there is only way to work with modern GUI like WPF or Silverlight but there must be way.
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#17 Zer033x

Zer033x

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 50 posts
  • Programming Language:C++, C#, Lua
  • Learning:C++, C#, JavaScript, Lua, Others

Posted 15 August 2012 - 09:27 PM

myWindows here is not a variable. It is object that holds the reference on Opções class.
It's like you have created a new class that contains the same code as Opções. Laic, you could say it is something like inheritance.

If he want to make a game, he will first need to learn OOP in C#. All concepts + graphic in C#. That is not something you can learn in few days.


True it is an object, but I always view creating objects like creating variables, variable objects. Classes are just custom types so when you instantiate an instance of the class you could say you're creating a variable of the classX type. If I wanted I could create a class and overload all operators to make my class behave just like other types. To me a variable is just a name given to data that can have varying values. It is all semantics, but I prefer thinking of them as variables that hold data for my class functionality.
  • 0

#18 obiwans

obiwans

    CC Lurker

  • New Member
  • Pip
  • 9 posts
  • Programming Language:(Visual) Basic
  • Learning:C, C++, C#, Visual Basic .NET, Pascal

Posted 16 August 2012 - 05:39 AM

Thanks for all the help . After 7 days of looking on the internet i found the code .
this.Content = new Opções();
especial thanks to "Tonchi" For all the help. Thanks too your code's i found this one . really thanks for the help
  • 0

#19 Tonchi

Tonchi

    Helping the world with programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1249 posts
  • Location:Zagreb
  • Programming Language:C#, Others
  • Learning:C, C++, Python, JavaScript, Transact-SQL, Assembly

Posted 16 August 2012 - 07:40 AM

True it is an object, but I always view creating objects like creating variables, variable objects. Classes are just custom types so when you instantiate an instance of the class you could say you're creating a variable of the classX type. If I wanted I could create a class and overload all operators to make my class behave just like other types. To me a variable is just a name given to data that can have varying values. It is all semantics, but I prefer thinking of them as variables that hold data for my class functionality.


You got it wrong. Class is not value type, it is reference type. Structure is value type. So you can't say that you are looking at that object as a variable because that's wrong thinking.
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#20 Zer033x

Zer033x

    CC Resident

  • Advanced Member
  • PipPipPipPip
  • 50 posts
  • Programming Language:C++, C#, Lua
  • Learning:C++, C#, JavaScript, Lua, Others

Posted 16 August 2012 - 07:56 PM

You got it wrong. Class is not value type, it is reference type. Structure is value type. So you can't say that you are looking at that object as a variable because that's wrong thinking.


I don't understand how it is wrong thinking. I use variable to describe anything that is variable. Whether the class is a value type or a reference type it can still be variable in its data. When describing actual data in a class I will usually use the term data members, but those could be called variables as well. Variable to me is a general term that can fit lots of things.
  • 0

#21 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 17 August 2012 - 01:58 AM

Well, if a variable is put into a class for storing information about the object it's going to be created as, it is called a member instead of variable. This is to separate terms from others. A variable can be used in a class as for temporary storage in the methods, but if it is part of the class as a whole, they are members.
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.


#22 Tonchi

Tonchi

    Helping the world with programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1249 posts
  • Location:Zagreb
  • Programming Language:C#, Others
  • Learning:C, C++, Python, JavaScript, Transact-SQL, Assembly

Posted 17 August 2012 - 03:26 AM

In C#, variables that are part of some class are called fields and they will work only when class instance is alive.
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#23 AceInfinity

AceInfinity

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 313 posts
  • Programming Language:C, C++, C#, Perl, Visual Basic .NET, Assembly, VBScript, Others

Posted 17 August 2012 - 10:02 PM

Well, if your options form in a new form called Form3

You'll make a code like this

Form3 Form3 = new Form3();
Form3.Show();

Sorry if that wasn't the answer, but maybe i didn't understand your point!


Don't name your variables the same as the name of the class for that particular Form. Now how do you differentiate between the 2? Form3 isn't the class Form3 anymore. ALWAYS remember to use unique identifiers...
  • 1

Microsoft MVP (2012) - .NET Programming | ®Crestron DMC-T Certified Programmer
Posted Image


#24 MuStA

MuStA

    CC Regular

  • Member
  • PipPipPip
  • 43 posts
  • Location:Saudi Arabia
  • Programming Language:C#, PHP, Transact-SQL, Lua, Others
  • Learning:C, C++, Others

Posted 18 August 2012 - 12:36 PM

Don't name your variables the same as the name of the class for that particular Form. Now how do you differentiate between the 2? Form3 isn't the class Form3 anymore. ALWAYS remember to use unique identifiers...

I know it may cause problems, but when you start typing, you'll see the real Form3 and the class Form3, and select it ;)
  • 0
.Musta { background-color: Black; }





Also tagged with one or more of these keywords: visual studio, 2012, windows 8, button

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download