CS411 Assignment 2 Solution and Discussion


  • Cyberian's Gold

    Visual Programing (CS411)
    Assignment#02 (GRADED)
    Total marks = 20
    Deadline Date = 03-12-2019
    Please carefully read all the instructions carefully before attempting the assignment.
    Problem Statement:
    You are required to create a WPF application, title must be your VU ID:
    One Text Box:
    Your application will have textbox for input field along with label:
    Student ID
    One Button:
    Search (This button will read data from text file)
    One Label:
    A final label for showing Student correct and complete name against VUID or a failure note. (“VUID not found”)

    Clicking Search button will read the ID from text box and search text file, the file name of .text file will be your study program.txt, for example if your study program is BSCS then file name must be bscs.txt.
    Please Note that your text file will be with at least 3 records of random valid VUIDs along with names which includes your own Valid VU ID and name. Below is the text file template (this is just example you can change text file format according to requirements)
    Bc12345678-Ahmad Ali
    MC34567890-Sher Khan
    BC123678954-Haider

    Write your own VU id in the application name and id fields while creating .gif file, otherwise your assignment will not be accepted.
    Output.gif has been attached with this Assignment file please observe this file carefully your program’s output must be like this output file.
    Submission details
    Following Files Must be submitted in a single zip or rar file.
    • .C# code file
    • .XAML File (Front End file)
    • Text file (named as your (program name.txt)
    • A .gif file which shows Run phase of your Application (For Recording .gif a software named Screentogif is uploaded on LMS, or you can use any other gif recording tool as well)
    You are not required to submit the complete project, only copy these three files from project folder. Please note if you submit doc file you will be awarded 0 marks.
    If you do not submit any of the above mentioned file 25% marks per file will be deducted.

    assignment2gif.gif


  • Cyberian's Gold

    Main Code File

            string stringToSearch = TextBox1.Text;
            string[] lines = File.ReadAllLines(@"H:/james.txt");
            foreach (string line in lines)
            {
                if (line.IndexOf(stringToSearch) >= 0)
                {
                    Label1.Content = line;
                    break;
                }
                else
                {
                    Label1.Content = "VU ID Not Found";
                }
            }
    

    XAML File

    <Window x:Class="CS411_Assign.MainWindow"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           Title="MainWindow" Height="350" Width="525">
       <Grid>
           <TextBox x:Name="TextBox1" HorizontalAlignment="Left" Height="23" Margin="165,87,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="237"/>
           <Button Content="Search" HorizontalAlignment="Left" Margin="165,153,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/>
           <Label x:Name="Label1" Content="Data" HorizontalAlignment="Left" Margin="165,206,0,0" VerticalAlignment="Top" Width="222"/>
           <Label Content="Vu-Student Id" HorizontalAlignment="Left" Margin="10,87,0,0" VerticalAlignment="Top"/>
    
       </Grid>
    </Window>
    

  • Cyberian's Gold


  • Cyberian's Gold



    Recent Topics


|