EpiDataView Object

EpiDataView Object  

       

EpiDataView Object

 

The EpiDataView Object encapsulates a DataView of a particular DataTable that corresponds to a Table in your database. There is usually a direct correlation between a Database Table and an EpiDataView. To investigate the specific EpiDataViews available for a given UI application, see the Object Explorer tool's Data Objects tab.

EpiDataView Object - spectragem - 丝碧@翠音.spectragem

 

How to Access the EpiDataView Object

The EpiDataView object is available under the UI Object tab and the Data Objects Tab. The UI tab contains the methods and properties based on the EpiDataView, in this case, the Job Entry form. the Data Objects Tab displays the actual field data for the selected object.

Assuming you are still inside the Object Explorer follow these steps to review the details of the Job Entry EpiDataView:

 

1. Select the UI Object Tab to see the available properties and methods for the Job Entry EpiDataView.

2. Select the Data Objects tab to view the actual fields to see what properties and methods are available

3. To view the DataView (fields) behind the object (tables) select the Data object and then click the DataView symbol.

 

Sample Code Uses for the EpiDataView Object

Instructor Note

Have the class open the EpiDataView object and review some of the examples in that listing.

Below are a few examples to provide or discuss for uses.

 

? A reference to an EpiDataView object is usually obtained through the Transaction objects EpiDataViews collection as shown in the following line of code:

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("ViewName"), EpiDataView)

Alternatively, the same entry using C# is

EpiDataView edv = (EpiDataView)oTrans.EpiDataViews("JobHead");

 

? To access or set a field's value in an EpiDataView, use the following VB.NET code: (写入数据到EpiDataView)

Dim someValue As String = edv.dataView(edv.Row)("FieldName")

edv.dataView(edv.Row)("FieldName") = someValue

Alternatively, the same entry using C# is

string someValue = (string)edv.dataView[edv.Row]["FieldName"];

edv.dataView[edv.Row]["FieldName"]= someValue;

? The Notify() Method notifies bound controls of updates to the underlying EpiDataView. The method uses this code for VB.Net:

(刷新绑定控件,即UI界面)

edv.Notify(New EpiNotifyArgs([FormName], edv.Row, edv.Column))

Alternatively, the same entry using C# is

edv.Notify(New EpiNotifyArgs([FormName], edv.Row, edv.Column));

 

? Another important method for this object is the InitializeCustomCodeI(). This method is

used to extend the properties of the object. The following code extends the propertis of the

PONUM inside the OrderHed EpiDataView. The VB.NET Code is:

Private Sub SetExtendedProps()

‘// Get EpiDataView reference

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)

If edv.dataView.Table.Columns.Contains("PONum") Then

edv.dataView.Table.Columns("PONum").ExtendedProperties("ReadOnly") = True

edv.dataView.Table.Columns("PONum").ExtendedProperties("Enabled") = False

‘// or to make invisible…

‘edv.dataView.Table.Columns("PONum").ExtendedProperties("IsHidden") = False

End if

End Sub

The C# code is as follows:

private static void SetExtendedProps()

{

// Get EpiDataView reference

Dim edv As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)

if (edv.dataView.Table.Columns.Contains("PONUM"))

{

edv.dataView.Table.Columns["PONum"].ExtendedProperties["ReadOnly"] = true

edv.dataView.Table.Columns["PONum"].ExtendedProperties["Enabled"] = false

// or to make invisible...

//edv.dataView.Table.Columns["PONum"].ExtendedProperties["IsHidden"] = false

}

}

Note The reference to make invisible in the above code demonstrates the manual way to hide a field. There is also an Extended Properties wizard available to manipulate these properties (discussed later in the course).



转自:http://spectragem.blog.163.com/blog/static/99994562201052934217726/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值