Alright so Im making this sports application where whenever the user clicks on a radio button with a designated sport a message apporiate to that sport will come up . I also want to have a 'different' picture show up for each different click of a corresponding sport . Would I just layer some textboxes and set autocheck property to false I tried doing that but nothing would display at all. also what would be te best way to store pictures to use them in this program should I grab a URL or store them in a local folder .

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    //using System.Windows.Data;
    //using System.Windows.Documents;
    //using System.Windows.Input;
    //using System.Windows.Media;
    //using System.Windows.Media.Imaging;
    //using System.Windows.Shapes; 


    namespace sportsApp
    {
    public partial class Form1 : Form
    {

        /// <summary>
        ///  how to eliminate double messagebox windows opening from previous selection
        /// </summary>
        public Form1()
        {
            InitializeComponent();
        }

        //public CollectionView ImageCollectionView
        //{

        //    get { return (CollectionView)GetValue(ImageCollectionViewProperty); }

        //    set { SetValue(ImageCollectionViewProperty, value); }

        //}

        //// Using a DependencyProperty as the backing store for ImageCollectionView. This enables animation, styling, binding, etc...

        //public static readonly DependencyProperty ImageCollectionViewProperty =

        //DependencyProperty.Register("ImageCollectionView", typeof(CollectionView), typeof(Window1), new UIPropertyMetadata(null));


        private void rdoBtnSoccer_CheckedChanged(object sender, EventArgs e)
        {
            MessageBox.Show("Drink plenty of water ! "); 
        }

        private void rdoBtnBasketball_CheckedChanged(object sender, EventArgs e)
        {
            MessageBox.Show("Warm up !"); 

        }

        private void rdoBtnKarate_CheckedChanged(object sender, EventArgs e)
        {
            MessageBox.Show("Remember to Bow before sparring !");
        }

        private void rdoBtnFootball_CheckedChanged(object sender, EventArgs e)
        {
            MessageBox.Show("Wear protective shoulder pads and a helmet !");

        }

        private void rdoBtnRunning_CheckedChanged(object sender, EventArgs e)
        {
            MessageBox.Show("Be sure to drink plenty of fluids and only high carb foods NO foods with fiber"); 

        }

        private void pictureBoxDisplaySport_Click(object sender, EventArgs e)
        {
            this.rdoBtnBasketball.Show(); 
        } // end of rdoBtnSoccer
    }
}

Edited 4 Years Ago by pyTony: Minor code formatting problem fixed

ok so I have finally figured out how to display the images in the picturebox with each radiobutton click (love that feeling!)
now I have a question I implemented some messagebox lines to display a message for every sport click. How would I make it so the messagebox window for the previous window does not show up and also the new sport the user picks(so if had picked soccer and now picks running the previous messagebox will show up and then the one for running)

here is my updated code: P.S Still trying to figure out DaniWeb's new code formatting arghh...

 namespace sportsApp
{
public partial class Form1 : Form
{

    /// <summary>
    ///  how to eliminate double messagebox windows opening from previous selection
    /// </summary>
    public Form1()
    {
        InitializeComponent();
    }



    private void rdoBtnSoccer_CheckedChanged(object sender, EventArgs e)
    {
        MessageBox.Show("Drink plenty of water ! ");
        Image image = Image.FromFile("soccer.png");
        pictureBoxDisplaySport.Image = image; 

    }

    private void rdoBtnBasketball_CheckedChanged(object sender, EventArgs e)
    {
        MessageBox.Show("Warm up !"); 
        Image image = Image.FromFile("basketball.png");
        pictureBoxDisplaySport.Image = image;
        pictureBoxDisplaySport.Height = image.Height;
        pictureBoxDisplaySport.Width = image.Width; 

    }

    private void rdoBtnKarate_CheckedChanged(object sender, EventArgs e)
    {
        MessageBox.Show("Remember to Bow before sparring !");
        Image image = Image.FromFile("karate.jpg");
        pictureBoxDisplaySport.Image = image; 

    }

    private void rdoBtnFootball_CheckedChanged(object sender, EventArgs e)
    {
        MessageBox.Show("Wear protective shoulder pads and a helmet !");
        Image image = Image.FromFile("football.jpg");
        pictureBoxDisplaySport.Image = image; 


    }

    private void rdoBtnRunning_CheckedChanged(object sender, EventArgs e)
    {
        MessageBox.Show("Be sure to drink plenty of fluids and only high carb foods NO foods with fiber");
        Image image = Image.FromFile("running.jpg");
        pictureBoxDisplaySport.Image = image; 

    }

    private void pictureBoxDisplaySport_Click(object sender, EventArgs e)
    {
        this.rdoBtnBasketball.Show(); 
    } // end of rdoBtnSoccer
}
    }
This article has been dead for over six months. Start a new discussion instead.