I want to use these 2 properties Enabled vs. Read-Only but it is different from normal control of windows

I want to use these 2 properties Enabled vs. Read-Only but it is different from normal control of windows

I understand that if I use Enabled to lock the data, I won’t be able to take advantage of the contextmenustrip of the epicor built open with…

But I use Read-Only attribute to take advantage of the context menu of the epicor system, when I press new control, it automatically opens for the user to edit data, I can add setting this attribute again. when adding new

private void CostForm_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		SysMonitorTasksAdapter adapterSysMonitorTasks = new SysMonitorTasksAdapter(this.oTrans);
		adapterSysMonitorTasks.BOConnect();
		Ice.Lib.Searches.SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
		opts.DataSetMode = DataSetMode.RowsDataSet;
				
		bool morePages = false;
		string whereClause = string.Format("SubmitUser='{0}' and TaskDescription='Load Costing Workbench Details' and Company='{1}'",session.UserID,session.CompanyID);
		opts.NamedSearch.WhereClauses.Add("SysTask", whereClause);
		// Call Adapter method
		SysMonitorTasksDataSet dsSysMonitorTasks = (SysMonitorTasksDataSet)adapterSysMonitorTasks.GetRows(opts, out morePages);
		countLoad=dsSysMonitorTasks.Tables[0].Rows.Count;
		txtGroup.ReadOnly = true;
	}

but if in windows system only need to set 1 time in form load, if there is no place open, it will not be able to open? Here why when creating a new system from reopening the property that is already set
Read-Only=true in from load this will easily cause errors if the writer does not pay attention
When you get an old group, it won’t be able to fix it


but when the new group is new, the groupid will be fixed even though readonly is set in the load form

Good to know. Thanks! Have a nice day!

In my experience, the best way to handle this is Row Rules. As you say, Enabled=false on the control removes the context menu among other things, and ReadOnly=true does not “stick”.

But Row Rules do stick. Within the Row Rules Wizard there are a few similar sounding options like “EpiReadOnly”, “Disabled”, etc. I don’t remember all the differences between these row status types, but I have always had the best experience with “Disabled”. It does not mean the same thing as the “Enabled” flag at the control level.

2 Likes

Thank you, I did use this method: Use Tools-> Wizards->Modify extended Properties->Select the data view and choose the property as Read only.
and here is the generated code after i use it:

//Use Tools-> Wizards->Modify extended Properties->Select the data view and choose the property as Read only.
	private void SetExtendedProperties()
	{
		// Begin Wizard Added EpiDataView Initialization
		EpiDataView edvGroup = ((EpiDataView)(this.oTrans.EpiDataViews["Group"]));
		// End Wizard Added EpiDataView Initialization

		// Begin Wizard Added Conditional Block
		if (edvGroup.dataView.Table.Columns.Contains("GroupID"))
		{
			// Begin Wizard Added ExtendedProperty Settings: edvGroup-GroupID
			edvGroup.dataView.Table.Columns["GroupID"].ExtendedProperties["ReadOnly"] = true;
			// End Wizard Added ExtendedProperty Settings: edvGroup-GroupID
		}
		// End Wizard Added Conditional Block
	}

Thanks have a good day :grinning: :grinning: :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: