Youtube RSS Feed
Learn with Vikas Suhag
Design an application that uses the concept of Dialog Control using C#.Net.
Nov 16, 2021   Vikas Suhag

AIM: Design an application that uses the concept of Dialog Control using C#.Net.

Source Code :

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

                               

namespace WindowsFormsApplication4

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            if (openFileDialog1.ShowDialog() != DialogResult.Cancel)

                MessageBox.Show(openFileDialog1.FileName);

            listBox1.Items.Add(openFileDialog1.FileName);

 

        }

 

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)

        {

            pictureBox1.Image = Image.FromFile(listBox1.SelectedItem.ToString());

        }

 

        private void button2_Click(object sender, EventArgs e)

        {

            if (listBox1.Items.Count > 0)

            {

                timer1.Start();

            }

            else

            {

                MessageBox.Show("Please Select Address");

            }

        }

        int i = 0;

        private void timer1_Tick(object sender, EventArgs e)

        {

            if (i < listBox1.Items.Count)

            {

                pictureBox1.Image = Image.FromFile(listBox1.Items[i].ToString());

                i++;

            }

            else

            {

                i = 0;

            }

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            timer1.Stop();

        }

    }

}

Output:


Leave a Comment

* Email will not be published.
All comments are only visible after approval.
Most Viewed articles
Search
Subscribe to Email Updates
Vikas Suhag

I am Engineer, Developer, Teacher, Blogger, Vlogger, Traveller, Photographer...

I have been developing websites, writing blogs and recording videos during my travel while being a full tim ...

Youtube Channel
Podcast
Subscribe to Email Updates
Connect With Us
Youtube RSS Feed
© 2021 Learn with Vikas Suhag. All Rights Reserved.