AnalogNumeric Control loop

Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
Post Reply
Aurimas94
Posts: 6
Joined: Mon Nov 18, 2019 4:12 am

AnalogNumeric Control loop

Post by Aurimas94 »

Hello, given the example viewtopic.php?f=9&t=1493#top I am unable to make same loop through AnalogNumeric controls. Can someone help with this?
here is the code I have:

Code: Select all

	using Neo.ApplicationFramework.Controls.Script;
	
	public partial class FSystemInfo
	{
		
		void Button1_Click(System.Object sender, System.EventArgs e)
		{
			
			AnalogNumericCFAdapter myTxt = GetTextBox("an_ABC");
			myTxt.Value = 2;
		}
		
		public AnalogNumericCFAdapter GetTextBox(string txtName){
			
			Type FormType = this.GetType();
			FieldInfo field = FormType.GetField(txtName,BindingFlags.NonPublic | BindingFlags.Instance);

			if( field != null ){
			    
				Neo.ApplicationFramework.Controls.Controls.Label lb;
				lb = (Neo.ApplicationFramework.Controls.Controls.Label) field.GetValue(this);
				AnalogNumericCFAdapter myTxt;
				myTxt = this.AdapterService.CreateAdapter<Neo.ApplicationFramework.Controls.Script.AnalogNumericCFAdapter>(lb);
				return myTxt;
			}
			return null;
			
		}
	}
In here "an_ABC" is the AnalogNumeric. When you run application it throws an exception that "Object ref not set to an instance of an object".

Post Reply