Create Table in Windows Store App

In this article you will learn how to create a table of a particular number entered by you. Just like the counting table that we saw in earlier classes. Now the table logic is implemented in a Windows Store  app.

Use the following procedure to create the table in a Windows Store app.

Step 1

First of all you have to create a New Window Store Application, as in the following:

  • Open Visual Studio 2012
  • "File" -> "New" -> "Project..."
  • Choose Template: "Visual C#" -> "Window Store app"
  • "Blank App (XAML)", then rename the application


Step 2

Write the following simple XAML code for "Mainpage.Xaml" (that is available in Solution Explorer):










    <Grid Background="Red">


            <ColumnDefinition Width="461*"/>

            <ColumnDefinition Width="905*"/>



            <RowDefinition Height="97*"/>

            <RowDefinition Height="52*"/>

            <RowDefinition Height="50*"/>

            <RowDefinition Height="46*"/>

            <RowDefinition Height="523*"/>


        <TextBlock Text="Create Table App" FontSize="20" FontFamily="Arial" FontWeight="ExtraBold" Foreground="White" Grid.Column="1" Grid.Row="1"/>

        <TextBlock Text="Enter number" FontSize="20" FontFamily="Arial" FontWeight="ExtraBold" Foreground="White" Grid.Column="0" Grid.Row="2" TextAlignment="Right"></TextBlock>

        <TextBox x:Name="textbox1" Grid.Column="1" Grid.Row="2" Width="200" Height=" 25" HorizontalAlignment="Left" VerticalAlignment="Top" ></TextBox>

        <Button x:Name="button1" Content="Click" Click="button1_Click" Grid.Column="1" Grid.Row="3" Background="Yellow" Foreground="Black" Margin="0,4" Width="118" ></Button>

        <TextBlock x:Name="text1" Grid.Column="1" Grid.Row="4" TextWrapping="Wrap" Width="794"  HorizontalAlignment="Left" Margin="0,0,0,75" FontSize="15" FontWeight="ExtraBold" ></TextBlock>               




Step 3

Now write the following C# code for the button within "Mainpage.Xaml.cs":

using System;

using System.Collections.Generic;

using System.IO;

using System.Linq;

using Windows.Foundation;

using Windows.Foundation.Collections;

using Windows.UI.Xaml;

using Windows.UI.Xaml.Controls;

using Windows.UI.Xaml.Controls.Primitives;

using Windows.UI.Xaml.Data;

using Windows.UI.Xaml.Input;

using Windows.UI.Xaml.Media;

using Windows.UI.Xaml.Navigation;


namespace table_app

    public sealed partial class MainPage : Page


        public MainPage()




        protected override void OnNavigatedTo(NavigationEventArgs e)



        private void button1_Click(object sender, RoutedEventArgs e)


            int num = 0, i;

            num = Convert.ToInt32(textbox1.Text);

            for (i = 1; i <= 10; i++)


                text1.Text += num + "*" + i + "=" + (num * i);

                text1.Text += Environment.NewLine;






Step 4

Run your app.