Page 1
Page 2
Tapping a graphics can be handled in
similar way. For example if a user taps the shopping cart
image within the selected row, the application shows an
order form.
Private Sub AdvancedList1_CellClick(ByVal
sender As Object,
ByVal e As Resco.Controls.CellEventArgs)
Handles AdvancedList1.CellClick
' Handle the cell click event,
in this case we check
' whether the shopping cart ImageCell
was clicked
If e.DataRow.CurrentTemplateIndex
= 2 Then
Select
Case e.CellIndex
Case 1 ' Shopping cart
' Show ordering form
End Select
End If
End Sub
DetailView an Alternative Way of
Displaying Detailed Information.
Although the AdvancedList control displays
more details for the selected row, it is usually not possible
to display the complete information there, because of lack
of space. If a user wants to display/edit all details pertaining
the selected customer, the application should display a
separate form for this purpose.
DetailView
is the .NET CF control designed specifically for this purpose.
It is easy to set-up in the designer through its Items collection,
and it supports all standard controls like TextBox, ComboBox,
DateTimePicker, etc. for editing of the displayed data.
Every item in the collection can be mapped to the database
field through its Name property, so just one simple loop
is needed to fill all items in the details form from the
AdvancedLists selected row, or alternatively DataReader
or DataSet objects.
For i = 0 To DetailView1.Items.Count
- 1
DetailView1.Items(i).Value = _
myAdvancedList.SelectedRow.Item(DetailView1.Items(i).Name)
Next
What's more these few lines of code
can be used in all detailed forms of your project, no matter
what data its going to display/edit.
Items can be created also dynamically,
so it gives you an opportunity to create your details form
during the run-time if the character of your data changes
based on the situation.
Another nice feature of the DetailView
is the way it handles the situation when a user enters incorrect
value into an item. Here the ErrorMessage property can be
used. When you set it to any non-empty text, the control
fills the corresponding item with red color and displays
the ! character next to it. Tapping and holding the !
character displays an error message explaining why the value
is incorrect. Everything can be done in the ItemLostFocus
event.
Private Sub DetailView1_ItemLostFocus(ByVal
sender As Object, _
ByVal e As Resco.Controls.ItemEventArgs)
Handles DetailView1.ItemLostFocus
Select Case e.Name
Case "Email"
If e.item.Text.IndexOf("@") = -1 Then
e.item.ErrorMessage = "Incorrect value, '@' is missing!"
Else
e.item.ErrorMessage = ""
End If
End Select
End Sub
The following picture shows the DetailView
control displaying the complete information about the selected
customer.

As you can see from the picture above
appearance of the detail form is very similar to that of
the standard PIM applications like Contacts, or Calendar.
Similarly as in case of the AdvancedList, the control provides
quite strong functionality. Most of the work has been done
in the designer and only few lines of code were needed to
complete it.
In conclusion
Preview/Detail forms are definitely
very common in every database project. Although they can
be developed using the standard .NET CF controls, the method
I demonstrated in this article is a very efficient alternative.
Using the AdvancedList and DetailView controls I was able
to create the entire project in just a few minutes. Although
having written only few lines of source code the final application
has a nice look and robust functionality.
The same code can be used for a completely
different table with only minor changes in the Visual Studio
Designer, which means that the use of these two new components
can save you a considerable amount of time and money.
Buy these controls
AdvancedList
and DetailView.
For more information
Click
here to download AdvancedList Control.
Click
here to download DetailView Control.
Other RESCO controls
RESCO
Grid Control
RESCO Listview Control
Previous Page