Click here to Skip to main content
14,495,894 members
Rate this:
Please Sign up or sign in to vote.
See more:
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:

<Window x:Class="MyFirstWpfProject.MainWindow"
        Title="User Input Panel" Height="600.197" Width="1000.605" Background="DarkGray" FontFamily="Times New Roman" FontSize="30" FontStyle="Oblique">
        <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"/>



public partial class MainWindow : Window
        public MainWindow()

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

            if (username == "A" && password == "1")

                MessageBox.Show("Username or password error.");

Updated 26-Feb-19 10:44am

1 solution

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

Solution 1

[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