Click here to Skip to main content
15,886,026 members
Home / Discussions / C#
   

C#

 
AnswerRe: How To Access from C# python list of multi elements Pin
Richard Deeming12-Nov-13 8:43
mveRichard Deeming12-Nov-13 8:43 
QuestionNeed help ..... Pin
superselector11-Nov-13 22:15
superselector11-Nov-13 22:15 
AnswerRe: Need help ..... Pin
Eddy Vluggen11-Nov-13 22:34
professionalEddy Vluggen11-Nov-13 22:34 
AnswerRe: Need help ..... Pin
lukeer11-Nov-13 22:34
lukeer11-Nov-13 22:34 
AnswerRe: Need help ..... PinPopular
OriginalGriff11-Nov-13 22:35
mveOriginalGriff11-Nov-13 22:35 
GeneralRe: Need help ..... Pin
superselector12-Nov-13 0:57
superselector12-Nov-13 0:57 
AnswerRe: Need help ..... Pin
Mycroft Holmes11-Nov-13 23:22
professionalMycroft Holmes11-Nov-13 23:22 
QuestionChange Content of Button Pin
Member 1037988611-Nov-13 10:27
Member 1037988611-Nov-13 10:27 
Hi I am doing an exercise to change the content of a button 9windows app 7.1 VS2012)

I create the project and then its says

SQL
Drag a Button on to the Designer.  See how it updates the Xaml with the Button tag.  Selecting items in the Document Outline Window allows you to navigate the Xaml tree and it selects the item visually as well as in the Xaml.  It is a handy way to navigate complex Xaml if not all of the Xaml is visable.
 Select the Button go to the properties Window - this also creates events.
You can edit the control in the Properties Window or hand-edit the Xaml. To create an event you can either use the properties window or edit the Xaml.
To do this go to the Xaml for MainPage.xaml and find the Button that was added.  Type Click= and then tab to create the event handler.  This has been added in the code-behind .cs file.  Type Button1.Content = "Hello World!"

I have done what it has say and my MainPage.xaml.cs looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace Hello_World
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Button.Content = "Hello World";
        }
    }
}


the 'Button.Content' produces this error:

Error	1	An object reference is required for the non-static field, method, or property 

My MainPaipe.zaml has the following code in but no errors

<phone:phoneapplicationpage 
="" x:class="Hello_World.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designwidth="480" d:designheight="768" fontfamily="{StaticResource PhoneFontFamilyNormal}" fontsize="{StaticResource PhoneFontSizeNormal}" foreground="{StaticResource PhoneForegroundBrush}" supportedorientations="Portrait" orientation="Portrait" shell:systemtray.isvisible="True">

    
    <grid x:name="LayoutRoot" background="Transparent">
        <grid.rowdefinitions>
            <rowdefinition height="Auto">
            <rowdefinition height="*">
        

        
        <stackpanel x:name="TitlePanel" grid.row="0" margin="12,17,0,28">
            <textblock x:name="ApplicationTitle" text="MY APPLICATION" style="{StaticResource PhoneTextNormalStyle}">
            <textblock x:name="PageTitle" text="page name" margin="9,-7,0,0" style="{StaticResource PhoneTextTitle1Style}">
        

        
        <grid x:name="ContentPanel" grid.row="1" margin="12,0,12,0">
            <Button Content="Button" HorizontalAlignment="Left" Height="79" Margin="142,53,0,0" VerticalAlignment="Top" Width="171" Click="Button_Click_1"/>
        
    
 


Help Appreiated

Paddy

AnswerRe: Change Content of Button Pin
Pete O'Hanlon11-Nov-13 10:32
mvePete O'Hanlon11-Nov-13 10:32 
GeneralRe: Change Content of Button Pin
Member 1037988611-Nov-13 11:00
Member 1037988611-Nov-13 11:00 
GeneralRe: Change Content of Button Pin
Pete O'Hanlon11-Nov-13 11:18
mvePete O'Hanlon11-Nov-13 11:18 
Questionc# - Cinema system - Noob need help - 2d arrray - Pin
cSharpDonkey11-Nov-13 4:21
cSharpDonkey11-Nov-13 4:21 
AnswerRe: c# - Cinema system - Noob need help - 2d arrray - Pin
GuyThiebaut11-Nov-13 4:42
professionalGuyThiebaut11-Nov-13 4:42 
AnswerRe: c# - Cinema system - Noob need help - 2d arrray - Pin
Pete O'Hanlon11-Nov-13 4:43
mvePete O'Hanlon11-Nov-13 4:43 
AnswerRe: c# - Cinema system - Noob need help - 2d arrray - Pin
OriginalGriff11-Nov-13 5:18
mveOriginalGriff11-Nov-13 5:18 
AnswerRe: c# - Cinema system - Noob need help - 2d arrray - Pin
V.11-Nov-13 20:18
professionalV.11-Nov-13 20:18 
Questionsubtract list first element with second one,third with secon one an so on Pin
Member 1038120910-Nov-13 22:57
Member 1038120910-Nov-13 22:57 
AnswerRe: subtract list first element with second one,third with secon one an so on Pin
OriginalGriff10-Nov-13 23:05
mveOriginalGriff10-Nov-13 23:05 
GeneralRe: subtract list first element with second one,third with secon one an so on Pin
Member 1038120910-Nov-13 23:14
Member 1038120910-Nov-13 23:14 
GeneralRe: subtract list first element with second one,third with secon one an so on Pin
Pete O'Hanlon10-Nov-13 23:26
mvePete O'Hanlon10-Nov-13 23:26 
GeneralRe: subtract list first element with second one,third with secon one an so on Pin
Member 1038120910-Nov-13 23:32
Member 1038120910-Nov-13 23:32 
GeneralRe: subtract list first element with second one,third with secon one an so on Pin
Pete O'Hanlon10-Nov-13 23:47
mvePete O'Hanlon10-Nov-13 23:47 
GeneralRe: subtract list first element with second one,third with secon one an so on Pin
Member 1038120911-Nov-13 0:16
Member 1038120911-Nov-13 0:16 
GeneralRe: subtract list first element with second one,third with secon one an so on Pin
Pete O'Hanlon11-Nov-13 0:21
mvePete O'Hanlon11-Nov-13 0:21 
GeneralRe: subtract list first element with second one,third with secon one an so on Pin
Richard MacCutchan11-Nov-13 3:37
mveRichard MacCutchan11-Nov-13 3:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.