Solved

datagrid vs listview for self developed invoice control (or system)

Posted on 2004-04-29
4
846 Views
Last Modified: 2008-02-26
good day i need to make a form that can add items to a invoice
i am only aware of controls that i need to pay for and i live in a 3rd world country, (spare me the pity).
can anyone give me a tip on how to make one or what components i should use or any help would be appreciated.
these are the fields that need to be in the invoice system:
1      2            3      4      5            6      7      8
CODE      DESCRIPTION      QTY      UNIT      UNIT_PRICE      DISC      TAx      NET_PRICE

fields 1,2 requires another form to be called, and on this second form i will have a datagrid filled with appropriate values
once the user clicks on this second form, the values of the second form will be passed back to the invoice field.
fields 3,5,6,7,8 need to be similar to textboxes and will be filled from a dataset but will be editable as well
fields 4 is combobox type and the user will select for e.g. Meter/ kilogram/ etc.


so far it seems datagrid can do  most of them.
i have viewed this code from
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20728539.html
which enables a user to insert a combobox into a datagrid and it is brilliant.

Q1
would a datagrid or listview be better for this situation.
any other controls that would be suitable?

Q2
would i be able to call a combobox from a listview
as in http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20728539.html

Q3
will i be able to call another form from a cell in a datagrid?
would i be able to do it from a listview

Q4
any other known hiccups i will encounter

or

Q5
possible link to similar/helpful situation / solution
0
Comment
Question by:jxharding
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:tgannetts
Comment Utility
The datagrid is a much better option from the listview.... You can respond to which column and row a user has selected using the HitTest class:

You need to handle the Mouse_Down event, and determine which column the user has selected - doing this you will be able to activate forms etc

0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 250 total points
Comment Utility
Q1 I would go for the datagrid, I find it easier to manipulate
Q2 Yes, look here http://support.microsoft.com/default.aspx?scid=kb;EN-US;q320342
Q3 Yes, you can use the mouseup or mousedown event to determine the row and collumn
Q4 I don't think you will encounter much problems with the thing you want to do
0
 
LVL 5

Assisted Solution

by:tgannetts
tgannetts earned 250 total points
Comment Utility
So:

    Private Sub DataGrid1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown

        Dim ht As DataGrid.HitTestInfo

        ht = Me.DataGrid1.HitTest(e.X, e.Y)

        If ht.Type = Windows.Forms.DataGrid.HitTestType.Cell Then

            Select Case ht.Column

                Case 0
                    Dim form1 As New Form1()
                    If form1.ShowDialog = DialogResult.OK Then
                        Me.DataGrid1.Item(ht.Row, 0) = form1.YourValueName
                    End If
                Case 1

                Case 2

            End Select

        End If

    End Sub

This will open up a Modal form which the user can select a value from. If you make sure that value is stored in a property on the form, then you can add that value to the datagrid.

Hope this helps.

Tom
0
 
LVL 25

Expert Comment

by:RonaldBiemans
Comment Utility
Q5. This is an excelent site for the datagrid control http://www.syncfusion.com/FAQ/WinForms/default.asp#44
You will find most of your problems explained here
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now