Click here to Skip to main content
14,452,546 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello.
First of all, I'm sorry, maybe I'm asking a very simple and absurd question.I want to do one wpf project.

Page 1: will contain username and password.
I have done this as follows. But I want to keep a database.
So I prepared a table with Id, User name and password as DbPerson. How do I do this.

Page 2: If the page is adding records, there will be deletions.
But I could not switch to page 2. How should I design a new model, view and view model.

Can you help me with this?

What I have tried:

MainWindow.xmal
<Window x:Class="MyFirstWpfProject.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:MyFirstWpfProject"
        mc:Ignorable="d"
        Title="User Input Panel" Height="600.197" Width="1000.605" Background="DarkGray" FontFamily="Times New Roman" FontSize="30" FontStyle="Oblique">
    <Grid>
        <Button x:Name="button" Content="Save" Command="{Binding SaveCommand}" HorizontalAlignment="Left" Margin="330,447,0,0" VerticalAlignment="Top" Width="324" Height="64" FontFamily="Times New Roman" Foreground="Black" FontSize="30" Click="btnSave" />
        <Label x:Name="label" Content="Username:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="191,160,0,0" Height="70" Width="211" FontSize="30" FontFamily="Times New Roman" FontStyle="Italic"/>
        <Label x:Name="label1" Content="Password" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="191,282,0,0" Height="42" Width="149" FontSize="30" FontFamily="Times New Roman" FontStyle="Italic"/>
        <TextBox x:Name="txtusername" HorizontalAlignment="Left" Height="41" TextWrapping="Wrap"  VerticalAlignment="Top" Width="226" Margin="470,160,0,0"/>
        <TextBox x:Name="txtpassword" HorizontalAlignment="Left" Height="42" TextWrapping="Wrap" VerticalAlignment="Top" Width="226" Margin="470,282,0,0"/>
        <StackPanel Name="MyStackPanel"   HorizontalAlignment="Left" Height="559" VerticalAlignment="Top" Width="983"/>

    </Grid>
</Window>


MainWindow.xmal.cs

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void btnSave(object sender, RoutedEventArgs e)
        {
            string username = txtusername.Text;
            string password = txtpassword.Text;

            if (username == "A" && password == "1")
            {
               
                MessageBox.Show("Successfull");

            }
            else
            {
                MessageBox.Show("Username or password error.");
            }

        }
    }
Posted
Updated 26-Feb-19 11:44am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Comments
[no name] 26-Feb-19 16:58pm
   
After the login page I tried to do, I asked how to switch to the user operations page.
thanks for the source.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100