|
-
Aug 1st, 2008, 12:13 PM
#1
Thread Starter
Fanatic Member
how to display data in DataGrid control
please tell me how to display data in DataGrid control, the simplest way to do it. please this is very urgent to me
-
Aug 1st, 2008, 12:47 PM
#2
Re: how to display data in DataGrid control
What is your source of data? A recordset is best so you would only need to specify the binding to the grid.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2008, 12:58 PM
#3
Thread Starter
Fanatic Member
Re: how to display data in DataGrid control
this is my code im using ADO
Code:
Private Sub Form_Load()
Set Cn = New ADODB.Connection
Cn.Provider = "Microsoft.Jet.OLEDB.4.0"
Cn.ConnectionString = App.Path & "\db1.mdb"
Cn.Open
Set Rs = New ADODB.Recordset
Rs.Open "Table1", Cn, adOpenDynamic, adLockOptimistic, adCmdTable
End Sub
my table has these fields
f_name
l_name
address
phone
email
i want to show them in the Data Grid, i never used this control before. please give me very simple solution
-
Aug 1st, 2008, 01:10 PM
#4
Re: how to display data in DataGrid control
I guess its best to figure out of a grid is the correct control for you..
Are your users going to be editing records?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2008, 09:27 PM
#5
Thread Starter
Fanatic Member
Re: how to display data in DataGrid control
 Originally Posted by RobDog888
I guess its best to figure out of a grid is the correct control for you..
Are your users going to be editing records?
please tell me both for editing and the Grid you said above
-
Aug 2nd, 2008, 01:56 PM
#6
Re: how to display data in DataGrid control
 Originally Posted by chunk
please tell me both for editing and the Grid you said above
The datagrid doesnt allow editing (or at least without much code and questionable logic ) so if you need the users to be able to edit directly in the grid then you need to at best use a ListView and some semi-complicated code to "float" a textbox over the cell to "simulate" direct entry.
Or use a 3rd party control.
Or use a set of textboxes at the top or bottom of the grid for editing the selected record. Then click an update button and have it update th record and relad the grid for ex.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 1st, 2008, 01:15 PM
#7
Re: how to display data in DataGrid control
I have used about every grid control there is but this one because it relies on a formal data structure. However, I dug this up for you.
"The DataGrid control in the "DataGrid Application" binds to a single DataSet object. The DataSet object of the "DataGrid Application" is initially populated from a database using an OleDbDataAdapter object.
What is a DataGrid?
The Windows Forms DataGrid control provides a user interface to ADO.NET datasets, displays ADO.NET tabular data in a scrollable grid, and allows for updates to the data source. In cases where the DataGrid is bound to a data source with a single table containing no relationships, the data appears in simple rows and columns, as in a spreadsheet. The DataGrid control is one of the most useful and flexible controls in Windows Forms. As soon as the DataGrid control is set to a valid data source, the control is automatically populated, by creating columns and rows based on the structure of the data. The DataGrid control can be used to display either a single table or the hierarchical relationships between a set of tables."
------------
That's as far as I can take you. Hope this helps get you started.
-
Aug 2nd, 2008, 01:53 PM
#8
Re: how to display data in DataGrid control
 Originally Posted by Code Doc
I have used about every grid control there is but this one because it relies on a formal data structure. However, I dug this up for you.
"The DataGrid control in the "DataGrid Application" binds to a single DataSet object. The DataSet object of the "DataGrid Application" is initially populated from a database using an OleDbDataAdapter object.
What is a DataGrid?
The Windows Forms DataGrid control provides a user interface to ADO.NET datasets, displays ADO.NET tabular data in a scrollable grid, and allows for updates to the data source. In cases where the DataGrid is bound to a data source with a single table containing no relationships, the data appears in simple rows and columns, as in a spreadsheet. The DataGrid control is one of the most useful and flexible controls in Windows Forms. As soon as the DataGrid control is set to a valid data source, the control is automatically populated, by creating columns and rows based on the structure of the data. The DataGrid control can be used to display either a single table or the hierarchical relationships between a set of tables."
------------
That's as far as I can take you. Hope this helps get you started.
I think that is pertenant to VB.NET and not VB6
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 2nd, 2008, 07:18 PM
#9
Re: how to display data in DataGrid control
You can edit, add and delete the data in a DataGrid. Set the AllowUpdate, AllowAdd and AllowDelete property to True. Are you asking how to load data into a DataGrid?
-
Aug 2nd, 2008, 08:01 PM
#10
Re: how to display data in DataGrid control
Ah so you can. Havent used it much at all. usually use Flexgrids or listviews. But still using a bound control is problematic when you want to do filtering and searches etc.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 2nd, 2008, 11:19 PM
#11
Thread Starter
Fanatic Member
Re: how to display data in DataGrid control
thanks west4dbt, thanks Rob
i have uploaded a simple example on my other thread please see that and just change the fields name in the data grid
http://www.vbforums.com/showpost.php...63&postcount=4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|