i wan to create a table to show my sales report in vb,but we are not allowed to use datagridview what type of form we can use to show our sales report without using datagridview...?

Dani AI

Generated

Good pick — for a WinForms VB.NET app a ListView in Details view is the simplest, familiar way to show a table-like sales report (columns, subitems, grouping, sorting, icons). It’s the lightest built-in control that looks like a grid without using DataGridView. (learn.microsoft.com)

Practical setup notes and small tips (avoids repeating the column/item code already posted): set the view and common usability flags so the control behaves like a grid:

ListView1.View = View.Details
ListView1.FullRowSelect = True
ListView1.GridLines = True
ListView1.LabelEdit = True   ' only edits the first column label

LabelEdit edits only the main item label (first column); subitems must be edited with a separate technique (overlay a TextBox positioned at the subitem bounds after a HitTest, then write the text back on Leave/Enter). See the docs on subitems for details. (learn.microsoft.com)

When ListView is not the right fit: a TableLayoutPanel works well for small, fixed reports where each cell can be a Label/TextBox (good for fully custom layouts and printing via normal PrintDocument workflows), while a WebBrowser control (set DocumentText to an HTML table) is handy for rich formatting and one-click printing/export to PDF/print preview. These are good alternatives when formatting or print fidelity is more important than interactive grid features. (learn.microsoft.com)

Performance and scale: for very large datasets use ListView.VirtualMode and supply items on demand (handle RetrieveVirtualItem) instead of loading thousands of ListViewItem objects; for full reporting/printing consider exporting to CSV/Excel or using a reporting control. (learn.microsoft.com)

Summary: ’s ListView approach is the standard answer; add FullRowSelect/GridLines, handle subitem editing via an overlayed TextBox if editing is required, switch to TableLayoutPanel or HTML/WebBrowser for layout/print needs, and use VirtualMode for large data sets.

Recommended Answers

All 2 Replies

you can use listview,,

here is how to populate the columns with headers something like this

ListView3.Columns.Add("NAME", 150, HorizontalAlignment.Left)
        ListView3.Columns.Add("SCREEN NAME", 150, HorizontalAlignment.Left)
        ListView3.Columns.Add("LOCATION", 150, HorizontalAlignment.Left)
        'ListView3.Columns.Add("DEDSCRIPTION ?", 50, HorizontalAlignment.Left)
        ListView3.Columns.Add("URL", 100, HorizontalAlignment.Left)
        ListView3.Columns.Add("FOLLOWERS", 100, HorizontalAlignment.Left)
        ListView3.Columns.Add("FRIENDS", 100, HorizontalAlignment.Left)
        'ListView3.Columns.Add("FOLLOWING", 60, HorizontalAlignment.Left)
        ListView3.Columns.Add("MESSAGES SENT", 100, HorizontalAlignment.Left)

and you can add data to the listview something like this

Dim ScreenName As System.Xml.XmlNodeList = doc.GetElementsByTagName("screen_name")
            Dim location As System.Xml.XmlNodeList = doc.GetElementsByTagName("location")
            Dim Str2 As String = ""
            Dim Str3 As String = ""


            For Each node In doc.DocumentElement.SelectNodes("//user")
                ' Str2 = node.Item("location").InnerText
                'Str3 = node.Item("screen_name").InnerText
                Dim str(7) As String
                Dim itm As ListViewItem



                str(0) = node.Item("name").InnerText
                str(1) = node.Item("screen_name").InnerText
                str(2) = node.Item("location").InnerText
                ' str(3) = node.Item("description").InnerText
                str(3) = node.Item("url").InnerText
                str(4) = node.Item("followers_count").InnerText
                str(5) = node.Item("friends_count").InnerText
                ' str(6) = node.Item("following").InnerText
                str(6) = node.Item("statuses_count").InnerText
                'profile_image_url



                itm = New ListViewItem(str)
              
                                            ListView3.Items.Add(itm)

T_Tthanks alot~!!its help me alot...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.