Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
to show the data in the tabular format that are stored in the oracle database in vb.net .I don't want to use data grid view. if it possible use list method otherwise   


What I have tried:

Dim oh As New Helper.Oracle.OracleHelper
Dim str As New System.Text.StringBuilder
 Dim dt As DataTable
  Dim dr As DataRow
  Dim sql As String
dt = oh.ExecuteDataSet(sql).Tables(0)
  If dt.Rows.Count > 0 Then
      For Each dr In dt.Rows
          Str.Append(dr(0))
          Str.Append("®")
          Str.Append(dr(1))
          Str.Append("®")
          Str.Append(dr(2))
          Str.Append("®")
          Str.Append(dr(3))
          Str.Append("®")
          Str.Append(dr(4))
          Str.Append("®")
          Str.Append(dr(5))
          Str.Append("®")
          Str.Append(dr(6))
          Str.Append("®")
      Next
  end if
Posted
Updated 21-Jul-22 19:22pm
Comments
Maciej Los 22-Jul-22 1:46am    
Why to force doors wide open?

1 solution

You could, but ... it'll give you a load more trouble than a DataGridView would.
You could use a multiline TextBox: put each row in an array of strings, with each column separated by TAB characters. Then set the TextBox.Lines property to teh array and it's display in a table. Sort of.
It'll work, but ... if any column contains data which is longer than the other rows data it'll "push" columns to the right sideways.
If any column data exceeds the "table" right hand edge it'll wrap to the next line.
It's a mess, and it'll be a right PITA to sort out.

Use a table-based control, and it'll all be sorted out for you: use a DataAdapter to load a DataTable direct from your DB and set the DataSource of the DataGridView to the DataTable - not only will it do all the hard work for you, it'll allow your uses to select rows, columns, or cells, sort by specific columns, justify as needed, format specific data differently, and so forth.

Why reinvent the wheel if you end up with a worse experience fro your users and a load more trouble for you?
 
Share this answer
 
Comments
Sreedevi p krishnan 22-Jul-22 3:12am    
can you please give a better code to this
OriginalGriff 22-Jul-22 3:29am    
Code for what?
Sreedevi p krishnan 22-Jul-22 7:37am    
I want to bind data from database to a tabular format in vb.net
OriginalGriff 22-Jul-22 7:48am    
Yes, I guessed that ... what is preventing you from doing that?

What have you tried?
Where are you stuck?
What help do you need?
CHill60 22-Jul-22 7:48am    
Then bind your data to a tabular format control Advanced Basics: Data Binding in Visual Basic .NET | Microsoft Docs[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900