Flex Grid equivalent in .NET
Hi Folks,
We are using the Mh3DList control in our VB 6 application. Becubed hasn't come up with a .NET version so far. I need to replace this control and I was thinking of putting in a MSFLexGrid. What is the nearest equivalent for this control in Vb .NET?
Cheers,
Abhijit
Re: Flex Grid equivalent in .NET
I think the closest native control you'll get is the DataGrid.
Re: Flex Grid equivalent in .NET
How do I add items to a datagrid? Datagrid appears to be a databound control. I need something where the data can be loaded from the code instead of the database.
Re: Flex Grid equivalent in .NET
I've never actually had the need to use it myself, but if its databound, then you should be able to bind to just about anything that supports IEnumerable. An ArrayList for instance.
Like I said, I've never used the WinForms Datagrid, so I don't really know how it works.
Re: Flex Grid equivalent in .NET
Quote:
Originally Posted by abhijit
How do I add items to a datagrid? Datagrid appears to be a databound control. I need something where the data can be loaded from the code instead of the database.
This sample code creates a sample datatable with 3 collumns and 3 datarows...
Code:
Private m_DataTable As New DataTable("MyTableName")
Private Sub AddRow(ByVal sCol0 As String, ByVal sCol1 As String, ByVal sCol2 As String)
Dim NewRow As System.Data.DataRow = m_DataTable.NewRow()
NewRow(0) = sCol0
NewRow(1) = sCol1
NewRow(2) = sCol2
m_DataTable.Rows.Add(NewRow)
End Sub
Private Sub InitData()
'Set up the DataTable
m_DataTable = New DataTable("TableName")
m_DataTable.Columns.Add(New System.Data.DataColumn("Column0"))
m_DataTable.Columns.Add(New System.Data.DataColumn("Column1"))
m_DataTable.Columns.Add(New System.Data.DataColumn("Column2"))
'Set up the datagrid control
DataGrid1.DataSource = m_DataTable
End Sub
Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitData()
AddRow("1", "2", "3")
AddRow("4", "9", "12")
AddRow("77", "192", "0")
Me.DataGrid1.DataSource = m_DataTable
End Sub
Regards
Jorge
Re: Flex Grid equivalent in .NET
ComponentOne has a FlexGrid.NET and Infragistics has an UltraWinGrid control. Both are pretty good and very flexible.
Although if you're not willing to shell out the money for it, the datagrid in .NET is a major improvement over the VB6 datagrid/flexgrid.
Re: Flex Grid equivalent in .NET
Shelling out money is the client's prerogative. I can't do much in that aspect.
Re: Flex Grid equivalent in .NET
Hey Mendhak,
Keep bumping into you on the .NET forum.
This is the second thread I've seen where you were talking about a flexgrid.net.
It sounds like you've gotten used to the datagrid now. Is it the way to go? I would never bind a control if I had an alternative.
Anyway, i usually don't use the grid for database stuff. But I am pretty comfortable with MSFlexgrid.
Still, if you think it's better, do you mean for database work?
I just started working on .NET today. and after taking in a mountain of new info, I'm hesitant to make any fast choices now.
With flexgrid, I am usually feeding an array, or sets of arrays into rows and columns on the grid that I can reference by r,c according to their array group and index number.
But what I've read in .NET help is that the data will have to be in a datatable, and bound to the datagrid anyway.
Have you used the datagrid in this fashion? If so, do you still think it is better than MSFlexgrid? I've been reading more flexible, but so far it seems less flexible.