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

#1 obiwans

obiwans

    CC Lurker

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

Posted 10 August 2012 - 08:43 AM

Hi guys . i am working with visual studio 2012 on windows 8 ..
I am tryng to creat a button that will open on other "page"
But i dont know the code .. (Already got the button just need the programming)
Can someone help me ?

Sorry by my bad English.
  • 0

#2 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 10 August 2012 - 09:12 AM

What kind of application are you creating? Metro Style? WinForms? WPF? Silverlight?
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#3 VNFox

VNFox

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 648 posts
  • Programming Language:C#, PHP
  • Learning:Assembly

Posted 10 August 2012 - 09:42 AM

Are you trying to open a webpage url when the user clicks on the button?
  • 0

www.pickmike.com
I don't just develop software. I find solutions to your business needs.


#4 Jorndel

Jorndel

    CC Lurker

  • New Member
  • Pip
  • 4 posts
  • Programming Language:C#
  • Learning:C#

Posted 10 August 2012 - 10:38 PM

WinForm: System.Diagnostics Process.Start("URL");
This is the way I have been using for a long time.
(Also seen many others so :P)
  • 0

#5 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 10 August 2012 - 11:10 PM

WinForm: System.Diagnostics Process.Start("URL");
This is the way I have been using for a long time.
(Also seen many others so :P)


Yes that's the way for WinForms
  • 1

Microsoft Student Partner, Microsoft Certified Professional


#6 obiwans

obiwans

    CC Lurker

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

Posted 13 August 2012 - 05:20 AM

sorry i was without internet for a moment . I am creating a game .
ex:
I click on the button "options" and other page will open with more 3 options.
I just dont know the code for that ..
And i am using Metro Style
Again sorry for my bad english i .
  • 0

#7 MuStA

MuStA

    CC Regular

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

Posted 13 August 2012 - 10:07 AM

sorry i was without internet for a moment . I am creating a game .
ex:
I click on the button "options" and other page will open with more 3 options.
I just dont know the code for that ..
And i am using Metro Style
Again sorry for my bad english i .


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!
  • 1
.Musta { background-color: Black; }

#8 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 13 August 2012 - 12:10 PM

As far as I know Metro Style apps doesn't contains Form class. Form class is strictlly for non XAML GUI's.
I have never worked with Silverlight but in WPF part of framework you are using Window class insted Form class, so maybe you should try something like this:

myWindow Window = new myWindow();
mywindow.Show();

myWindow is just an instance of Window class.
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#9 obiwans

obiwans

    CC Lurker

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

Posted 14 August 2012 - 05:27 AM

Img: http://desmond.image...png&res=landing or http://imageshack.us...4/83476187.png/ (cant place the image on forum is to big ..)
Maybe this will help . I try to place the .show and says "Test1.opções does not contain a definition for show."
  • 0

#10 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 14 August 2012 - 06:15 AM

In that case you need to make a little adjusment to my previous code:

myWindow Opções = new myWindow();
mywindow.Show();

put the button control on your MainPage and put that code inside that button. Run your application and click that button. Did it worked?
  • 0

Microsoft Student Partner, Microsoft Certified Professional


#11 obiwans

obiwans

    CC Lurker

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

Posted 14 August 2012 - 07:18 AM

2 erro's:
1:http://imageshack.us...6/73009249.png/
2:http://imageshack.us...1/58677743.png/

was there i need to place the code?
  • 0

#12 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 14 August 2012 - 01:28 PM

Forgive me. It should be like this:

Opções myWindow = new Opções();
myWindows.Show();

I suggest you to find some C# book and start to read it and practice tasks from it.
This is the most basic concept of programming in C# when you are working with GUI type of application.

I doubt that you even know what XAML is and why are people using it.
  • 0

Microsoft Student Partner, Microsoft Certified Professional






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