Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. C# Beginner - Online Student Project

C# Beginner - Online Student Project

Scheduled Pinned Locked Moved Visual Studio
csharplinqcomgraphicsdesign
3 Posts 2 Posters 14 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13955494
    wrote on last edited by
    #1

    I am a 100% online student trying to learn C#. My instructor has not been of help, so I am looking for help elsewhere. My homework is to create a program that will convert measurements: "

    In the English measurement system, 1 yard equals 3 feet and 1 foot equals 12 inches. Use this information to create an application that lets the user convert distances to and from inches, feet, and yards. Use list boxes for the user to select units being converted from and another list box for the user to select units being converted from.

    Write your code in the following order
    Program must check for correct input into the textbox. Hint: use TryParse.
    Check that user has selected a from unit. If not, let user know no unit has been selected.
    Check that user has selected a to unit. If user selects the same unit for both from and to, let them know that they need to select a different unit.

    " I believe I have my TryParse correct. It will make sure a measurement has been entered, a from distance has been selected and a to distance has been selected. After that, I am not sure where to proceed. I don't know how to grab what is selected in the from groupbox to the to groupbox and then convert. Any help would be appreciated. Thanks!

    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;

    namespace Distance_Converter
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

        private void convertButton\_Click(object sender, EventArgs e)
        {
            double distanceInput;
            double inches;
            double feet;
            double yards;
            string measurementFrom;
    
            if (double.TryParse(distanceTextBox.Text, out distanceInput));
            {
                if (fromListBox.SelectedIndex != -1)
                {
                    if (toListBox.SelectedItem = != -1)
                    {
                        
    
                    }
                }
    
            }
    
        }
    }
    

    }

    Image of UI: Capture — imgbb.com[^]

    M 1 Reply Last reply
    0
    • U User 13955494

      I am a 100% online student trying to learn C#. My instructor has not been of help, so I am looking for help elsewhere. My homework is to create a program that will convert measurements: "

      In the English measurement system, 1 yard equals 3 feet and 1 foot equals 12 inches. Use this information to create an application that lets the user convert distances to and from inches, feet, and yards. Use list boxes for the user to select units being converted from and another list box for the user to select units being converted from.

      Write your code in the following order
      Program must check for correct input into the textbox. Hint: use TryParse.
      Check that user has selected a from unit. If not, let user know no unit has been selected.
      Check that user has selected a to unit. If user selects the same unit for both from and to, let them know that they need to select a different unit.

      " I believe I have my TryParse correct. It will make sure a measurement has been entered, a from distance has been selected and a to distance has been selected. After that, I am not sure where to proceed. I don't know how to grab what is selected in the from groupbox to the to groupbox and then convert. Any help would be appreciated. Thanks!

      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;

      namespace Distance_Converter
      {
      public partial class Form1 : Form
      {
      public Form1()
      {
      InitializeComponent();
      }

          private void convertButton\_Click(object sender, EventArgs e)
          {
              double distanceInput;
              double inches;
              double feet;
              double yards;
              string measurementFrom;
      
              if (double.TryParse(distanceTextBox.Text, out distanceInput));
              {
                  if (fromListBox.SelectedIndex != -1)
                  {
                      if (toListBox.SelectedItem = != -1)
                      {
                          
      
                      }
                  }
      
              }
      
          }
      }
      

      }

      Image of UI: Capture — imgbb.com[^]

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Silly person - only post in one forum as duplicating the question will irritate the responders and duplicate the work!

      Never underestimate the power of human stupidity RAH

      U 1 Reply Last reply
      0
      • M Mycroft Holmes

        Silly person - only post in one forum as duplicating the question will irritate the responders and duplicate the work!

        Never underestimate the power of human stupidity RAH

        U Offline
        U Offline
        User 13955494
        wrote on last edited by
        #3

        Figured out this would probably be the better place. Delete was disabled on other post.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups