This uses Inheritance

Im am doing inheritance on the console line, and well all is semi ok. But what im confused on is how do this in a windows design.

I am trying to complete something, but I dont even know where to start.

I was hoping someone could help me. Here are what I need for classes. And what they have to do. of course this all posts up on a listbox.

Ive tried this with console and for the most part i got it working, but it was static info in the code, but the same setup in windows i have no clue.

The base class will be Vehicle. The Car and Truck classes will inherit from the Vehicle class. The Vehicle class will be composed of an object of the FuelTank class. The FuelTank class has 2 attribute variables: (mTankCapacity and mCurrentValue).

In addition to the FuelTank object, the attribute variables of the Vehicle class are: mVehID, mDesc, mOdometer, and mMPG. In addition to setting up properties for the variables as needed, the Vehicle class has the following methods: AddFuel() - receives the amount of fuel to be added to the tank and adds that to the tank if the tank will hold it. If it will, it returns a true; otherwise, a false. FillTank() – fills the tank and returns a string indicating the amount of gallons added to the tank.

The attribute variable of the Car class is mNumRiders. The methods of the Car class are: getMPG() – a method that calculates the current MPG. The MPG is reduced by 2% for every rider over 1. (For example if the car's mpg is 28.5 and there are 5 riders, the current mpg is 26.22). MoveForward() – receives the mileage to move forward. The method determines if there is enough fuel to make the trip. If not, it returns false. If there is enough fuel to make the trip, the mileage is added to the odometer and the gas tank is reduced by the amount of gas needed for the trip.

The attribute variable of the Truck class is mLoadLbs. The methods of the Truck class are: getMPG() – a method that calculates the current MPG. The MPG is reduced by 3% for every thousand pounds if the load is >= 1,000 pounds. For example if the truck's mpg is 13.4 and is loaded with 4000 pounds, the current mpg is 11.79. Another example is if the truck's mpg is 13.4 loaded with 500 pounts, the current mpg is 13.4. MoveForward() – receives the mileage to move forward. The method determines if there is enough fuel to make the trip. If not, it returns false. If there is enough fuel to make the trip, the mileage is added to the odometer, the gas tank is reduced by the amount of gas needed for the trip, and the method returns true.

So thats the classes, go give a visual refrence there is a listbox, a move forward button and a add fuel button.

I would honestly love the help on where to go with this, I am so lost but yet i really need to see a sample of this coded. All the samples I have are in console (look around the web and they all are) I would just like to see a sample like this in a windows format, seeing how its way more confusing.

Please I am really looking for help, if you wish to email me then fine, or something. As long as i can figure out how this dumb program goes. This is what you get when you get a lab book to teach your self but no teacher edition. *sigh* I look forward to your help.

Hmm, this sounds like fun. :) Lucky you.

I would love to see the code for the console & / or pseudo-code you have for the windows side. From there we can use that as a basis to create a windows versions, which by that I believe you mean a Windows Form Version? Suggestion: You would have a list box displaying the Truck or Vehicle attributes VehicleID (bound column), Description, Miles Per Gallon

Then you could tie the FillTank() / AddFuel () Methods to a button, when pressed adds the fuel and a message box or a text box could display the amount added.

Parent Class = Vehicle
-Common characteristics of a vehicle are
Description
ID
Odometer Value
Type
Percent Decline in MPG per Rider
Child Class(es) which inherit from the Parent
Type : Truck or Car
Description
Odometer Value
Percent Decline in MPG per Rider
mpg
Tank Size
Current Fuel Level
Max number of Riders


Etc..

or at least something along that line.

So once we get some code to work worth, this should come together nicely.

Look forward to getting your reply with code

Edit: This question would be a good thread to turn into a tutorial to teach others about inheritence.

Yes it is the forum window. The code thus far isnt much. I have done something somewhat similar to to this, but in console. And thats all my blasted book teachs is how to work in console yet I have this im working on and it wants it in windows form. It says there is little to no difference but I am not agreeing with that statement.

I think i just need to see a sample of a windows form based inheritance program that has a list box to display the outut and i should understand it.

Requardless ill put up the code in a bit.

Well this is what I have thus far, dont even know if im going the right way with this.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Lab1
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.ListBox lb_veh;
        private System.Windows.Forms.Button btn_1;
        private System.Windows.Forms.Button btn_2;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if (components != null) 
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.lb_veh = new System.Windows.Forms.ListBox();
            this.btn_1 = new System.Windows.Forms.Button();
            this.btn_2 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // lb_veh
            // 
            this.lb_veh.ItemHeight = 16;
            this.lb_veh.Location = new System.Drawing.Point(112, 40);
            this.lb_veh.Name = "lb_veh";
            this.lb_veh.Size = new System.Drawing.Size(352, 244);
            this.lb_veh.TabIndex = 0;
            // 
            // btn_1
            // 
            this.btn_1.Location = new System.Drawing.Point(128, 320);
            this.btn_1.Name = "btn_1";
            this.btn_1.TabIndex = 1;
            this.btn_1.Text = "Car";
            this.btn_1.Click += new System.EventHandler(this.btn_1_Click);
            // 
            // btn_2
            // 
            this.btn_2.Location = new System.Drawing.Point(312, 336);
            this.btn_2.Name = "btn_2";
            this.btn_2.TabIndex = 2;
            this.btn_2.Text = "Truck";
            this.btn_2.Click += new System.EventHandler(this.btn_truck_Click);
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
            this.ClientSize = new System.Drawing.Size(608, 478);
            this.Controls.Add(this.btn_2);
            this.Controls.Add(this.btn_1);
            this.Controls.Add(this.lb_veh);
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);

        }
        #endregion

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() 
        {
            Application.Run(new Form1());
        }

        private void btn_1_Click(object sender, System.EventArgs e)
        {
            lb_veh.Items.Clear();
            Car c2 = new Car(213, Camery, 2345, 5);
        }

        class Vehicle
        {
            private int mVehID;
            private string mDesc;
            private int mOdometer;
            //private double mMPG;
            
            public Vehicle (int VehID, string Desc, int Odometer)//, double MPG)
            {
                mVehid = VehID;
                mDesc = Desc;
                mOdometer = Odometer;
                //mMPG = MPG;

                // I would see if it writes it up to the list box here, but it wont.


                public Veh (int VehID, string Desc, int Odometer)
                {
                    VehID = mVehID;
                    Desc = mDesc;
                    Odometer = mOdometer;
                }
                public override string ToString()
                {
                    ListBox lb_veh = new ListBox();
                    lb_veh.Items.Add(VehID);
                }
            }
        }

        class Car : Vechicle
        {
            private int mNumRiders;

            public test1 (int VehID, string Desc, int odometer, int NumRiders)
            {
            base(VehID, Desc, odometer)
                lb_veh.Items.Add(NumRiders);
            }
            

        }

        class Truck : Vechicle
        {
            private double mloadpounds;
        }

        class MPG : Vechicle
        {
            private double mTankCapacity;
            //private double mCurrentValue;
        }

    }
}

Cool. I am off in an hour and have a long weekend for doing home reno's. I will work on this with you over the weekend... sound good? I have no development apps here at work, so I will help you piece this thing together.

Helps me get a little more up to speed on my C# as well. hehe.

And the details of being similar to the console is somewhat true. instead of console.writeline's you will be setting the display values in a listbox.

Fear not... I will gladly add what help I can.

good to hear.

I assume that everyone feels that I want this project done, far from the truth. I couldnt get anwhere if I did this. I think its the fact that theres another issue and thats forum 1 where as console it would not exist seeing how theres no buttons or anything else.

Maybe if someone can come up with a window form sample of the following

Pet supper class. And now the following. A cat "is a" pet with name(string) and cat_color(string)

and a Pet "has a" trick_id(int) and desc(string).

It displays on a list box

I guess if someone could code that up with a button to edit which trick it can do, I should be able to see whats going on. This way I can see the "is a" and "has a" in effect. This is what i get for trying to learn programming in my 20's :( Everyone else i speak to has been working on a type of programing since like 8. Oh well, im determined.

After i get this all sorted, ill be back with how to control the info on the screen. But right now i just want all the classes to talk and work.

Well off to english class

Well ill be in Sunday from 11am - 5am (central time) Monday. I look forward to seing this forum for help.

Well off to bed

The start of what I have.... working on it when I have time...

Code so far

public class Vehicle : FuelTank
		{
			private int m_VehID;
			private string m_Desc;
			private int m_Odometer;
			private double m_MPG;
	
			FuelTank vehicleTank = new FuelTank();
		
			public Vehicle()
			{
				/* Constructor */
			}
			~Vehicle()
			{
				/* Destructor */
			}
	
			public int VehID
			{
				get 
				{
		    		return m_VehID;
				}
				set
				{	
		    		m_VehID = value;
				}
			}
	
			public string Desc
			{
				get
				{
		    		return m_Desc;
				}
				set
				{
		    		m_Desc = value;
				}
			}
			public double MPG
			{
				get
				{
		    		return m_MPG;
				}
				set
				{
		    		m_MPG = value;
				}
			}
			public virtual int Odometer
			{
		    	get { return m_Odometer;}
		    	set { m_Odometer = value;}
			}
	
		    public bool AddFuel(int amt)
			{
				
		    	if (amt <= vehicleTank.TankCapacity)
				{
		    		return true;
				}
				else
				{
		    		return false;
				}
			}
			public int FillTank()
			{
				int iValue;
		    	iValue = vehicleTank.TankCapacity - vehicleTank.CurrentLevel;
				return iValue;
			}
		
		}	

		public class FuelTank
		{
			private int m_TankCapacity;
			private int m_CurrentLevel;
	
			public FuelTank()
			{
				/* Constructor */
			}
	
			~FuelTank()
			{
				/* Destructor */
			}
			public int TankCapacity
			{
				get
				{
		    		return m_TankCapacity;
				}
				set
				{
		    		m_TankCapacity = value;
				}
			}
	
			public int CurrentLevel
			{
				get
				{
		    		return m_CurrentLevel;
				}
				set
				{
		    		m_CurrentLevel = value;
				}
			}
		}

		public class Car : Vehicle
		{
			private int m_NumRiders;
			private const double FUEL_COST = 0.02;
			private double m_Mileage;
			
	
			public Car()
			{
				/* Constructor */
			}
			~Car()
			{
				/* Destructor */
			}
			public int NumRiders
			{
				get
				{
		    		return m_NumRiders;
				}
				set
				{
		    		m_NumRiders = value;
				}
			}
	
			public double Mileage
			{
				get
				{
		    		return m_Mileage;
				}
				set
				{
		    		m_Mileage = value;
				}
			}
			public override int Odometer
			{
		    	get { return Odometer;}
		    	set { Odometer = value;}
			
			}
		    public void MoveForward (double travelMileage)
			{
			
			}

	
		}

	}

Wow it didnt even inform me about this update, I would have sat down with you and gotten help. Ive been pulling my hair out for weeks now. This windows form is killing me. I made an 87 on the test, but im lost here.

What I have and what doesnt work. They erroring I take it needs to be in the car class when it chacks, but it doesnt work. If i put it at the button it works :cry:. As you can see I commented it out. And when this does work, it updates the load pounds and the people, but doesnt update the mileage which is based off that?! Oh god help... This is almost worth shooting my self in the foot over

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Lab1
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        car CAR = new car( 3, 15, 12, 199, "CAR", 22.1f, 78902.4f );
        truck TRUCK = new truck( 3000, 30, 16, 169, "TRUCK", 18.1f, 4902.4f );
        //disp_veh();
        private System.Windows.Forms.ListBox lb_Veh;
        private System.Windows.Forms.Button btn_Switch;
        private System.Windows.Forms.Button btn_Move;
        private System.Windows.Forms.TextBox tb_value;
        private System.Windows.Forms.Label lbl_Combo;
        private System.Windows.Forms.Button btn_Random;
        private System.Windows.Forms.Button btn_Fuel;
        private System.Windows.Forms.Button btn_Combo;
        bool isCar = true;
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if (components != null) 
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.lb_Veh = new System.Windows.Forms.ListBox();
            this.btn_Switch = new System.Windows.Forms.Button();
            this.btn_Move = new System.Windows.Forms.Button();
            this.tb_value = new System.Windows.Forms.TextBox();
            this.lbl_Combo = new System.Windows.Forms.Label();
            this.btn_Random = new System.Windows.Forms.Button();
            this.btn_Fuel = new System.Windows.Forms.Button();
            this.btn_Combo = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // lb_Veh
            // 
            this.lb_Veh.Location = new System.Drawing.Point(32, 16);
            this.lb_Veh.Name = "lb_Veh";
            this.lb_Veh.Size = new System.Drawing.Size(376, 173);
            this.lb_Veh.TabIndex = 0;
            // 
            // btn_Switch
            // 
            this.btn_Switch.Location = new System.Drawing.Point(32, 208);
            this.btn_Switch.Name = "btn_Switch";
            this.btn_Switch.Size = new System.Drawing.Size(160, 24);
            this.btn_Switch.TabIndex = 2;
            this.btn_Switch.Text = "Switch Vehicle";
            this.btn_Switch.Click += new System.EventHandler(this.btn_Switch_Click);
            // 
            // btn_Move
            // 
            this.btn_Move.Location = new System.Drawing.Point(248, 208);
            this.btn_Move.Name = "btn_Move";
            this.btn_Move.Size = new System.Drawing.Size(160, 23);
            this.btn_Move.TabIndex = 3;
            this.btn_Move.Text = "Move Forward";
            this.btn_Move.Click += new System.EventHandler(this.btn_Move_Click);
            // 
            // tb_value
            // 
            this.tb_value.Location = new System.Drawing.Point(216, 376);
            this.tb_value.Name = "tb_value";
            this.tb_value.Size = new System.Drawing.Size(184, 20);
            this.tb_value.TabIndex = 4;
            this.tb_value.Text = "";
            this.tb_value.Visible = false;
            this.tb_value.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_value_KeyDown);
            // 
            // lbl_Combo
            // 
            this.lbl_Combo.Location = new System.Drawing.Point(24, 376);
            this.lbl_Combo.Name = "lbl_Combo";
            this.lbl_Combo.Size = new System.Drawing.Size(176, 23);
            this.lbl_Combo.TabIndex = 5;
            this.lbl_Combo.UseMnemonic = false;
            // 
            // btn_Random
            // 
            this.btn_Random.Location = new System.Drawing.Point(32, 264);
            this.btn_Random.Name = "btn_Random";
            this.btn_Random.Size = new System.Drawing.Size(160, 23);
            this.btn_Random.TabIndex = 6;
            this.btn_Random.Text = "Random Move";
            this.btn_Random.Click += new System.EventHandler(this.btn_Random_Click);
            // 
            // btn_Fuel
            // 
            this.btn_Fuel.Location = new System.Drawing.Point(248, 264);
            this.btn_Fuel.Name = "btn_Fuel";
            this.btn_Fuel.Size = new System.Drawing.Size(160, 23);
            this.btn_Fuel.TabIndex = 7;
            this.btn_Fuel.Text = "Add Fuel";
            // 
            // btn_Combo
            // 
            this.btn_Combo.Location = new System.Drawing.Point(56, 320);
            this.btn_Combo.Name = "btn_Combo";
            this.btn_Combo.Size = new System.Drawing.Size(328, 23);
            this.btn_Combo.TabIndex = 8;
            this.btn_Combo.Visible = false;
            this.btn_Combo.Click += new System.EventHandler(this.btn_Combo_Click);
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(440, 438);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
            this.btn_Combo,
            this.btn_Fuel,
            this.btn_Random,
            this.lbl_Combo,
            this.tb_value,
            this.btn_Move,
            this.btn_Switch,
            this.lb_Veh});
            this.Name = "Form1";
            this.Text = "Form1";
            this.ResumeLayout(false);

        }
        #endregion

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() 
        {
            Application.Run(new Form1());
            //disp_veh();           
        }

        private void btn_Switch_Click(object sender, System.EventArgs e)
        {
            isCar = !isCar;
            disp_veh();
        }



        public class fueltank
        {
            double mTankCapacity, mCurrentValue;

            public fueltank()
            {

            }

            public fueltank( double tank, double val )
            {
                mTankCapacity = tank;
                mCurrentValue = val;
            }

            public double Tank
            {
                get
                {
                    return mTankCapacity;
                }
                set
                {   
                    mTankCapacity = value;
                }
            }

            public double Val
            {
                get
                {
                    return mCurrentValue;
                }
                set
                {   
                    mCurrentValue = value;
                }
            }


        }

        public class vehicle
        {
            public fueltank FuelTank = new fueltank();
            int mvehid;
            string mvehdesc;
            double mmpg, modometer; 

            public vehicle()
            {

            }

            public vehicle( double tank, double cval, int id, string desc, double mpg, double odo )
            {
                FuelTank.Tank = tank;
                FuelTank.Val = cval;

                mVehID = id;
                mVehDesc = desc;
                mMPG = mpg;
                mOdometer = odo;
            }

            public int mVehID;
            public string mVehDesc;

            public double mMPG
            {
                get
                {
                    return mmpg;
                }
                set
                {   
                    mmpg = value;
                }
            }

            public double mOdometer
            {
                get
                {
                    return modometer;
                }
                set
                {   
                    modometer = value;
                }
            }

        }

        public class car : vehicle 
        {
            int mnumriders;

            public car()
            {

            }

            public car( int pass, double tank, double cval, int id, string desc, double mpg, double odo) : base( tank, cval, id, desc, mpg, odo )
            {
                mNumRiders = pass;
            }

            public int mNumRiders
            {
                get
                {
                    return mnumriders;
                }
                set
                {
                    if (mnumriders > 0 || mnumriders < 6)
                    {
                        mnumriders = value;
                    }   
                    else
                    {
                        MessageBox.Show(" You must enter a number between 0 and 6.", 
                            "E R R O R", MessageBoxButtons.OK, 
                            MessageBoxIcon.Error);
                    }

                }

            }

            public double getMPG()
            {
                return mMPG * (1-0.02 * mNumRiders);
            }

            public bool MOVE (double miles)
            {
                double reqGal = getMPG() * miles;
                if (FuelTank.Val < reqGal)
                {
                    return false;
                }
                else
                {
                    mOdometer += miles;
                    FuelTank.Val -= reqGal;
                    return true;
                }
            }
        }

        public class truck : vehicle 
        {
            double mloadlbs;

            public truck()
            {

            }

            public truck( double load, double tank, double cval, int id, string desc, double mpg, double odo) : base( tank, cval, id, desc, mpg, odo )
            {
                mLoadLbs = load;
            }

            public double mLoadLbs
            {
                get
                {
                    return mloadlbs;
                }
                set
                {
                    if (mloadlbs > 0 || mloadlbs < 8000)
                    {
                        mloadlbs = value;
                    }
                    else
                    {
                        MessageBox.Show(" You must enter a number between 0 and 8000 lbs.", 
                            "E R R O R", MessageBoxButtons.OK, 
                            MessageBoxIcon.Error);
                    }
                }

            }
            public double getMPG()
            {
                return mMPG * (1 - 0.03 * mLoadLbs / 1000.0);
            }

            public bool MOVE (double miles)
            {
                double reqGal = getMPG() * miles;
                if (FuelTank.Val < reqGal)
                {
                    return false;
                }
                else
                {
                    mOdometer += miles;
                    FuelTank.Val -= reqGal;
                    return true;
                }
            }
        }

        public void disp_veh()
        {
            if ( isCar )
            {
                lb_Veh.Items.Clear();
                lb_Veh.Items.Add("Vehicle ID: "+CAR.mVehID);
                lb_Veh.Items.Add("Description: "+CAR.mVehDesc);
                lb_Veh.Items.Add("Odometer Reading: "+CAR.mOdometer);
                lb_Veh.Items.Add("MPG: "+CAR.mMPG);
                lb_Veh.Items.Add("Tank Capacity: "+CAR.FuelTank.Tank);
                lb_Veh.Items.Add("Current Value: "+CAR.FuelTank.Val);
                lb_Veh.Items.Add("Number Riders: "+CAR.mNumRiders);

            }
            else
            {
                lb_Veh.Items.Clear();
                lb_Veh.Items.Add("Vehicle ID: "+TRUCK.mVehID);
                lb_Veh.Items.Add("Description: "+TRUCK.mVehDesc);
                lb_Veh.Items.Add("Odometer Reading: "+TRUCK.mOdometer);
                lb_Veh.Items.Add("MPG: "+TRUCK.mMPG);
                lb_Veh.Items.Add("Tank Capacity: "+TRUCK.FuelTank.Tank);
                lb_Veh.Items.Add("Current Value: "+TRUCK.FuelTank.Val);
                lb_Veh.Items.Add("Load Pounds: "+TRUCK.mLoadLbs);

            }
            if ( isCar )
            {
                btn_Combo.Text = "Change Number of Riders";
                btn_Combo.Visible = true;
                lbl_Combo.Visible = false;
                tb_value.Visible = false;
            }
            else
            {
                btn_Combo.Text = "Change Load Pounds";
                btn_Combo.Visible = true;
                lbl_Combo.Visible = false;
                tb_value.Visible = false;
            }

            return;
        }


        private void btn_Move_Click(object sender, System.EventArgs e)
        {
            //CAR.forward(tb_value.Text);
        }

        private void btn_Combo_Click(object sender, System.EventArgs e)
        {
            if ( isCar )
            {
                lbl_Combo.Text = "Enter Number of Riders (1 - 6)";
                lbl_Combo.Visible = true;
                tb_value.Visible = true;

                // get the value from tb_value
            }
            else
            {
                lbl_Combo.Text = "Enter load pounds (0 - 8000)";
                lbl_Combo.Visible = true;
                tb_value.Visible = true;

                // get the value from tb_value 
            }
        }

        private void btn_Random_Click(object sender, System.EventArgs e)
        {
            // This will do a random number that will end up being the move distance.
        }

        private void tb_value_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter) 
            {
                if ( isCar )
                {
                    int temp = Convert.ToInt32(tb_value.Text);
                    tb_value.Hide();
                    disp_veh();
                }
                else
                {
                    double temp = Convert.ToDouble(tb_value.Text);
//                  if ( temp < 0 || temp > 8000)
//                  {
//                      MessageBox.Show(" You must enter a number between 0 and 8000 lbs.", 
//                          "E R R O R", MessageBoxButtons.OK, 
//                          MessageBoxIcon.Error);
//                  }
//                  else
//                  {
                        tb_value.Hide();
//                      TRUCK.mLoadLbs = temp;
                        disp_veh();
//                  }
                }
            }

        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.