Maintenance Screen Design for Parent Child Type Application ...

mond007

Active member
Joined
Apr 26, 2010
Messages
37
Location
near Solihull, Birmingham UK
Programming Experience
10+
Hi
I am hoping to enlist the opinion or alternatives to the following Screen Designs. I am basically developing an Application to maintain the following two tables.

My reading was the following link before posting this question, which I understood btw :
Master/Detail (Parent/Child) Data-binding (.NET 2.0+ WinForms)-VBForums

VB.NET:
        With QuestionAnswerData.Tables("Questions")
            .Columns.Add("QuestionID", GetType(Integer))
            .Columns.Add("QuestionNo", GetType(String))
            .Columns.Add("Question", GetType(String))
            .Columns.Add("AnswerSection", GetType(String))
            .Columns.Add("AnswerSectionColor", GetType(String))
            .Columns.Add("AnswerImage", GetType(String))
            .Columns.Add("AnswerHyperlink", GetType(String))
        End With
 
        With QuestionAnswerData.Tables("Answers")
            .Columns.Add("QuestionID", GetType(Integer))
            .Columns.Add("AnswerRef", GetType(String))
            .Columns.Add("AnswerFormat", GetType(String))
            .Columns.Add("AnswerColour", GetType(String))
            .Columns.Add("AnswerDescription", GetType(String))
        End With
I have done extensive reading up and I'm am exhausted by trying to choose the correct Databinding required for a parent/child to show my Listbox or something equivalent in the 1st Maintain Parent Screen and display the child record in screen. It maybe I am going about the wrong way - as there maybe a far more elegant solution by using automated method unknown to me (yet!). Would be great if there was a CMS system off the shelf but doubt it.

Maintain_Screen_1.jpg

Maintenance_Screen_2.jpg

Basically, even though the bottom half of the main Parent Screen 1 can be ignored, I am struggling to decide what form object to use to display a list of "Parent" records in table/column format. (I think I understand how to bind the two tables).

The Question is : Do I use a Listbox and load using ADO.Net to load the record details to Listbox Columns ?. The reason for not using DatagridViews is because they do not have the same look and feel of a well designed GUI for users (even with the controls).
I am looking for a clean table where rows are populated from the DataSet.

Thanks in advance for any suggestions. Kuldip.
 
The reason for not using DatagridViews is because they do not have the same look and feel of a well designed GUI for users (even with the controls).
I am looking for a clean table where rows are populated from the DataSet.

What exactly is not "clean" about a DataGridView? It is highly configurable so, if you want to change something, you quite probably can.
 
Hi
I guess I mean :

a) that you can't get rid of the left hand side column showing the asterisk, and have a "Add" button to add a parent.
b) Need to conceal any ID fields as users don't need to see these at all.
c) I couldn't work out how to add DatagridView controls but I guess i get to that without too much difficulty.
d) I suppose creating a preview from the child records of the Answers should be doable too.
e) Can you change the colours of the DataGridviews i.e Header Colour, Background colour etc.
f) Set Coloumn Widths.
g) How do you let users know how to user the DataGridView w.r.t. Adding and Deleting parent and or Child records. It's obvious to us but maybe needs more instructions for users. If you see what I mean.

I do like the DataGridView but maybe couldn't see how to make it user friendly. i.e. Looking like a Tabular matrix rather than like a programmers backend maintenance screen... because i can use it easy but some users may look at a DataGridView and not know what to do next to say "Add" a child record.

Don't mean to cynical or negartive but if I can get some of these issues resolved the I would "gladly" adopt this as i don't have to worry about having two screen and a busy screen layout. etc. etc. AND NOT TO MENTION A LOT LESS WORK FOR ME. :)

Let me know what you think. Kind Regards Kuldip (ps. I ill try and get an image of how I think I would imagine it).
 
a) that you can't get rid of the left hand side column showing the asterisk, and have a "Add" button to add a parent.
Um, yes you can. It's as simple as setting the RowHeadersVisible property to False.
b) Need to conceal any ID fields as users don't need to see these at all.
No problem. Just create the grid columns yourself without creating a column for the ID, then set AutoGenerateColumns to False. Alternatively, just hide that column after binding.
c) I couldn't work out how to add DatagridView controls but I guess i get to that without too much difficulty.
The grid will automatically create certain columns based on data type, e.g. a check box column for Boolean data. Various other column types can be added manually in the designer, e.g. combo box or hyperlink column. You can also create your own custom column types and add them in the designer too.

Adding a ComboBox Column to a DataGridView
How to: Host Controls in Windows Forms DataGridView Cells
d) I suppose creating a preview from the child records of the Answers should be doable too.
I don't know exactly what that means but I doubt that any other control would do so better than the DataGridView or that it's even the control's responsibility to do it.
e) Can you change the colours of the DataGridviews i.e Header Colour, Background colour etc.
Absolutely, there are various properties of the grid, the columns, the rows and the cells for that sort of thing.
f) Set Coloumn Widths.
Um, every column has a Width property, plus you can have the columns auto-size based on the data and the user can resize the columns themselves as well.
g) How do you let users know how to user the DataGridView w.r.t. Adding and Deleting parent and or Child records. It's obvious to us but maybe needs more instructions for users. If you see what I mean.
How does any user ever know how to use any application that their not familiar with? You're the developer so it's your responsibility to provide appropriate help and documentation for any application you create.

I think it's safe to say that you the DataGridView can do everything you want and that you should spend some time researching and experimenting with it.
 
Hi
Sounds wonderful to me. Makes my life easier indeed. I will have a go, I should be able to research all the info myself and if I get stuck I will post again.

Incidentally, how would one code up the "Add" button to either the Parent or Child to insert a new line. ? How does one get the Newly created ID ?

Also, the "preview" I was refering to was the ability to Select a row in the "Parent DataGridView" and read all the "Parent + Child" records and include this information into a RichTextBox as shown in my screen mock ups at the beginning of my Question. Need to know how to trigger some code in order to detect when a user has clicked a row in the parent table. Imagine clicking any Parent row and it creates a preview, if you see what I mean.

Thank you very much indeed. It refreshing to be able to get some help when you need it. :)
 
You bind the data to the grid via a BindingSource and handle the CurrentChanged event. It seems like you've thrown up a red herring with your talk of parent/child data-binding because you don't want to bind the child data at all. If you want to get the child records associated with a parent record then call GetChildRows on the parent DataRow.
 
Hi
I don't believe I have but how else can I ensure referential integrity between the two tables/DataGridViews.
Each Question must be linked to Answers rows via the IDs. My original post was :

http://www.vbdotnetforums.com/xml/60658-create-effective-xml-schema-data-load-dilemma.html
I got to grips with everything w.r.t XML Files when Ian Ryder said :
"Just have a look around the forum for Parent/Child Data Binding " in your signature. in order to code a screen to maintain my Dataset.
See http://www.vbdotnetforums.com/vs-ne...sual-studio-application-import-resources.html

Hmmm... now the Question seems to be do I need "Data Bind" the two tables in my Maintenance Application ? I step back maybe.

The two DataGridView tables live harmoniosly when linked and auto show matching records.

Need to have a think again then. Regards Kuldip.
 
I don't really understand the issue then. You ask how to create a preview. If you've got the parent data in one grid and the child data in the other then what's the problem? You've got the data; do whatever you want with it.
 
Ah ok.
sorry, I thought you meant w.r.t. the whole maintenance application. When it comes to the maintenance of the two tables, indeed I need the Data Binding but for just the preview I see that you only need the "CurrentChanged" and GetChildRows to show the preview. Thats fine.

Great, I will get coding now.

Thanks Kuldip
 
Last edited:
Absolutely wonderful,

I managed to create a fully functional working application which seamlessly hangs together well including a great preview using row = Me.DataGridView1.Rows(e.RowIndex) within the DataGridView1_CellClick box for the selected parent/child combo. See the following.
Maintain_Screen_0.jpg

However, I need to tidy up some areas.

1) I need to put a icon/image of a dustbin to allow for a "One Click Delete" of a Parent and child row.
See column to the right of the parent. I have seen the following
How to add a Button to each row in a DataGridView

and could "Add" a column with a button but could not find a way for a icon/delete image within the button.
Also, deleting of a 'child record' is easy

VB.NET:
If Not Datagridview1.Rows(RowIndex).IsNewRow Then
    Datagridview1..Rows.RemoveAt(RowIndex)
    Datagridview1..Refresh()
End If

But when deleting a parent I need to Msg the user to warn that all child records will also deleted. I think I might be able to work out the code for that.

2) I would like to lock down grid so that I have full control over how a row is added. I presume I would simply Disable the
VB.NET:
DataGridView.Enable = False
I have decided use as many textboxes as there are columns to add a ROW with my own validation for Mandatory fields etc. using the following code :

VB.NET:
ButtonAddParentRow_click ....
    Me.DataGridView1.Rows.Add(TxtBox_QuestionNo.Text, TxtBox_QuestionDescription.Text, etc. etc. 
End Sub

3) I am not sure how to add or whether its even applicable to add the following form control. I tried a few links but failed to find any info. I have a scroll bar no problem. The only thing that I might need is a "Search" facility, that's my next challenge.
DataGridView_controls.jpg

Thanks in advance for any suggestions. Kuldip.
PS. I ma glad I was encouraged to investigate the DataGridView concepts. Thankyou.
 
Last edited:
Back
Top