using System;using System.Windows.Forms;//To make it work, build a form with one NumericUpDown named NumericUpDown//and one trackbar named TrackbarUpDown.namespace Trackbar{public partial class Form1 : Form{public Form1(){InitializeComponent();}private void numericUpDown1_ValueChanged(object sender, EventArgs e){NumericUpDown numUpDn = (NumericUpDown)sender;string tBarName = numUpDn.Name.Replace("Numeric", "Trackbar");foreach (Control tbar in Controls){if (tbar.GetType() == typeof(TrackBar)){if (tbar.Name == tBarName){//The next will NOT work. The tbar does not have the Value property!tbar.Value = numUpDn.Value; }}}}private void trackBar1_Scroll(object sender, EventArgs e){TrackBar tbar = (TrackBar)sender;string numUpDnName = tbar.Name.Replace("Trackbar","Numeric"); //Changing namesforeach (Control numupdn in Controls){if (numupdn.GetType() == typeof(NumericUpDown)){if (numupdn.Name == numUpDnName){numupdn.Text = tbar.Value.ToString();}}}}}}